OSX work.

git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@7631 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Derek DeMoro
2007-03-21 18:07:27 +00:00
committed by derek
parent 842734145e
commit c9567a3387

View File

@ -11,6 +11,7 @@
package org.jivesoftware.spark.ui; package org.jivesoftware.spark.ui;
import org.jivesoftware.resource.Default; import org.jivesoftware.resource.Default;
import org.jivesoftware.Spark;
import java.awt.Color; import java.awt.Color;
import java.awt.FlowLayout; import java.awt.FlowLayout;
@ -30,17 +31,24 @@ public class CommandPanel extends JPanel {
private final Image backgroundImage; private final Image backgroundImage;
public CommandPanel() { public CommandPanel() {
if (Spark.isWindows()) {
setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
}
else {
setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
}
backgroundImage = Default.getImageIcon(Default.TOP_BOTTOM_BACKGROUND_IMAGE).getImage(); backgroundImage = Default.getImageIcon(Default.TOP_BOTTOM_BACKGROUND_IMAGE).getImage();
setBorder(BorderFactory.createMatteBorder(1, 1, 0, 1, new Color(197, 213, 230))); setBorder(BorderFactory.createMatteBorder(1, 1, 0, 1, new Color(197, 213, 230)));
} }
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
double scaleX = getWidth() / (double)backgroundImage.getWidth(null); double scaleX = getWidth() / (double) backgroundImage.getWidth(null);
double scaleY = getHeight() / (double)backgroundImage.getHeight(null); double scaleY = getHeight() / (double) backgroundImage.getHeight(null);
AffineTransform xform = AffineTransform.getScaleInstance(scaleX, scaleY); AffineTransform xform = AffineTransform.getScaleInstance(scaleX, scaleY);
((Graphics2D)g).drawImage(backgroundImage, xform, this); ((Graphics2D) g).drawImage(backgroundImage, xform, this);
} }
} }