use of javax.swing.ImageIcon in project voltdb by VoltDB.
the class FontDialogSwing method creatFontDialog.
/**
* Create and display FontDialogSwing Dialog.
*
*/
public static void creatFontDialog(DatabaseManagerSwing owner) {
if (isRunning) {
frame.setVisible(true);
} else {
CommonSwing.setSwingLAF(frame, CommonSwing.Native);
fOwner = owner;
frame.setIconImage(CommonSwing.getIcon("Frame"));
isRunning = true;
frame.setSize(600, 100);
CommonSwing.setFramePositon(frame);
ckbitalic = new JCheckBox(new ImageIcon(CommonSwing.getIcon("ItalicFont")));
ckbitalic.putClientProperty("is3DEnabled", Boolean.TRUE);
ckbitalic.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setStyle();
}
});
ckbbold = new JCheckBox(new ImageIcon(CommonSwing.getIcon("BoldFont")));
ckbbold.putClientProperty("is3DEnabled", Boolean.TRUE);
ckbbold.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setStyle();
}
});
fgColorButton = new JButton("Foreground", new ImageIcon(CommonSwing.getIcon("ColorSelection")));
fgColorButton.putClientProperty("is3DEnabled", Boolean.TRUE);
fgColorButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setColor(FOREGROUND);
}
});
bgColorButton = new JButton("Background", new ImageIcon(CommonSwing.getIcon("ColorSelection")));
bgColorButton.putClientProperty("is3DEnabled", Boolean.TRUE);
bgColorButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setColor(BACKGROUND);
}
});
closeButton = new JButton("Close", new ImageIcon(CommonSwing.getIcon("Close")));
closeButton.putClientProperty("is3DEnabled", Boolean.TRUE);
closeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.setVisible(false);
}
});
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
String[] fontNames = ge.getAvailableFontFamilyNames();
Dimension fontsComboBoxDimension = new Dimension(160, 25);
fontsComboBox = new JComboBox(fontNames);
fontsComboBox.putClientProperty("is3DEnabled", Boolean.TRUE);
fontsComboBox.setMaximumSize(fontsComboBoxDimension);
fontsComboBox.setPreferredSize(fontsComboBoxDimension);
fontsComboBox.setMaximumSize(fontsComboBoxDimension);
fontsComboBox.setEditable(false);
fontsComboBox.setSelectedItem(defaultFont);
fontsComboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setFont();
}
});
// weconsultants@users 20050215 - Added for Compatbilty fix for JDK 1.3
fontSizesComboBox = new JComboBox(fontSizes);
Dimension spinnerDimension = new Dimension(45, 25);
fontSizesComboBox.putClientProperty("is3DEnabled", Boolean.TRUE);
fontSizesComboBox.setMinimumSize(spinnerDimension);
fontSizesComboBox.setPreferredSize(spinnerDimension);
fontSizesComboBox.setMaximumSize(spinnerDimension);
fontSizesComboBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent evt) {
if (evt.getStateChange() == ItemEvent.SELECTED) {
setFontSize((String) evt.getItem());
}
}
});
// weconsultants@users 20050215 - Commented out for Compatbilty fix for JDK 1.3
// Dimension spinnerDimension = new Dimension(50, 25);
// spinnerFontSizes = new JSpinner();
// spinnerFontSizes.putClientProperty("is3DEnabled", Boolean.TRUE);
// spinnerFontSizes.setMinimumSize(spinnerDimension);
// spinnerFontSizes.setPreferredSize(spinnerDimension);
// spinnerFontSizes.setMaximumSize(spinnerDimension);
// spinnerModelSizes = new SpinnerNumberModel(12, 8, 72, 1);
// spinnerFontSizes.setModel(spinnerModelSizes);
// spinnerFontSizes.addChangeListener(new ChangeListener() {
// public void stateChanged(ChangeEvent e) {
// setFontSize();
// }
// });
Container contentPane = frame.getContentPane();
contentPane.setLayout(new FlowLayout());
contentPane.add(fontsComboBox);
// weconsultants@users 20050215 - Commented out for Compatbilty fix for 1.3
// contentPane.add(spinnerFontSizes);
// weconsultants@users 20050215 - Added for Compatbilty fix for 1.3
contentPane.add(fontSizesComboBox);
contentPane.add(ckbbold);
contentPane.add(ckbitalic);
contentPane.add(fgColorButton);
contentPane.add(bgColorButton);
contentPane.add(closeButton);
frame.pack();
frame.setVisible(false);
}
}
use of javax.swing.ImageIcon in project voltdb by VoltDB.
the class DatabaseManagerSwing method createToolBar.
protected JToolBar createToolBar() {
// Build jtoolbar and jtoolbar Buttons
JToolBar jtoolbar = new JToolBar();
jtoolbar.putClientProperty("JToolBar.isRollover", Boolean.TRUE);
// I'm dropping "Statement" from "Execute SQL Statement", etc.,
// because it may or may not be "one statement", but it is SQL.
// Build jbuttonClear Buttons - blaine
jbuttonClear = new JButton("Clear SQL", new ImageIcon(CommonSwing.getIcon("Clear")));
jbuttonClear.putClientProperty("is3DEnabled", Boolean.TRUE);
tipMap.put(jbuttonClear, "Clear SQL");
jbuttonClear.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionevent) {
if (sqlScriptBuffer == null && txtCommand.getText().length() < 1) {
CommonSwing.errorMessage("No SQL to clear");
return;
}
clear();
}
});
jbuttonExecute = new JButton("Execute SQL", new ImageIcon(CommonSwing.getIcon("Execute")));
tipMap.put(jbuttonExecute, "Execute SQL");
jbuttonExecute.putClientProperty("is3DEnabled", Boolean.TRUE);
jbuttonExecute.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionevent) {
executeCurrentSQL();
}
});
jtoolbar.addSeparator();
jtoolbar.add(jbuttonClear);
jtoolbar.addSeparator();
jtoolbar.add(jbuttonExecute);
jtoolbar.addSeparator();
jbuttonClear.setAlignmentY(0.5F);
jbuttonClear.setAlignmentX(0.5F);
jbuttonExecute.setAlignmentY(0.5F);
jbuttonExecute.setAlignmentX(0.5F);
return jtoolbar;
}
use of javax.swing.ImageIcon in project robo4j by Robo4J.
the class SSD1306DeviceTest method main.
public static void main(String[] args) throws IOException {
final SSD1306Device oled = new SSD1306Device(OLEDVariant.Type128x32, RaspiPin.GPIO_25);
Graphics2D gc = oled.getGraphicsContext();
gc.setColor(Color.white);
gc.setBackground(Color.black);
gc.clearRect(0, 0, 127, 31);
gc.drawLine(0, 0, 127, 31);
gc.drawString("Hello World!", 0, 32);
gc.setBackground(Color.white);
gc.fillOval(127 - 16, -16, 32, 32);
oled.pushImage();
JFrame frame = new JFrame();
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
try {
oled.setEnabled(false);
} catch (IOException e1) {
e1.printStackTrace();
//TODO: is it possible ?
} finally {
System.exit(0);
}
}
});
frame.setSize(256, 256);
frame.getContentPane().add(new JLabel(new ImageIcon(oled.getImage())));
frame.setVisible(true);
}
use of javax.swing.ImageIcon in project SIMRacingApps by SIMRacingApps.
the class HeaderForm method loadImage.
/**
* Helper method to load an image file from the CLASSPATH
* @param imageName the package and name of the file to load relative to the CLASSPATH
* @return an ImageIcon instance with the specified image file
* @throws IllegalArgumentException if the image resource cannot be loaded.
*/
public ImageIcon loadImage(String imageName) {
try {
ClassLoader classloader = getClass().getClassLoader();
java.net.URL url = classloader.getResource(imageName);
if (url != null) {
ImageIcon icon = new ImageIcon(url);
return icon;
}
} catch (Exception e) {
e.printStackTrace();
}
throw new IllegalArgumentException("Unable to load image: " + imageName);
}
use of javax.swing.ImageIcon in project SIMRacingApps by SIMRacingApps.
the class JreForm method loadImage.
/**
* Helper method to load an image file from the CLASSPATH
* @param imageName the package and name of the file to load relative to the CLASSPATH
* @return an ImageIcon instance with the specified image file
* @throws IllegalArgumentException if the image resource cannot be loaded.
*/
public ImageIcon loadImage(String imageName) {
try {
ClassLoader classloader = getClass().getClassLoader();
java.net.URL url = classloader.getResource(imageName);
if (url != null) {
ImageIcon icon = new ImageIcon(url);
return icon;
}
} catch (Exception e) {
e.printStackTrace();
}
throw new IllegalArgumentException("Unable to load image: " + imageName);
}
Aggregations