Methods Summary |
---|
public static void | centerOnScreen(java.awt.Component component)
Dimension paneSize = component.getSize();
Dimension screenSize = component.getToolkit().getScreenSize();
component.setLocation(
(screenSize.width - paneSize.width) / 2,
(screenSize.height - paneSize.height) / 2);
|
public static javax.swing.JButton | createButton(java.lang.String text)
JButton button = new JButton(text);
button.setFocusPainted(true);
button.setBorderPainted(true);
button.setContentAreaFilled(true);
return button;
|
public static javax.swing.JButton | createButton(java.lang.String text, java.lang.String icon)
return createButton(text, icon, false);
|
public static javax.swing.JButton | createButton(java.lang.String text, java.lang.String icon, boolean flat)
ImageIcon iconNormal = readImageIcon(icon + ".png");
ImageIcon iconHighlight = readImageIcon(icon + "_highlight.png");
ImageIcon iconPressed = readImageIcon(icon + "_pressed.png");
JButton button = new JButton(text, iconNormal);
button.setFocusPainted(!flat);
button.setBorderPainted(!flat);
button.setContentAreaFilled(!flat);
if (iconHighlight != null)
{
button.setRolloverEnabled(true);
button.setRolloverIcon(iconHighlight);
}
if (iconPressed != null)
button.setPressedIcon(iconPressed);
return button;
|
public static java.awt.Image | readImage(java.lang.String fileName)
URL url = UIHelper.class.getResource("images/" + fileName);
if (url == null)
return null;
return java.awt.Toolkit.getDefaultToolkit().getImage(url);
|
public static javax.swing.ImageIcon | readImageIcon(java.lang.String fileName)
Image image = readImage(fileName);
if (image == null)
return null;
return new ImageIcon(image);
|