use of com.cburch.logisim.gui.generic.CanvasPane in project logisim-evolution by reds-heig.
the class Startup method eventDispatched.
@Override
public void eventDispatched(AWTEvent event) {
if (event instanceof ContainerEvent) {
ContainerEvent containerEvent = (ContainerEvent) event;
if (containerEvent.getID() == ContainerEvent.COMPONENT_ADDED) {
Component container = containerEvent.getChild();
if ((container instanceof JButton) || (container instanceof JCheckBox) || (container instanceof JComboBox) || (container instanceof JLabel) || (container instanceof JMenu) || (container instanceof JMenuItem) || (container instanceof JRadioButton) || (container instanceof JRadioButtonMenuItem) || (container instanceof JSpinner) || (container instanceof JTabbedPane) || (container instanceof JTextField) || (container instanceof JHelp) || (container instanceof JFileChooser) || ((container instanceof JScrollPane) && (!(container instanceof CanvasPane))) || (container instanceof JFontChooser) || (container instanceof JCheckBoxMenuItem)) {
AppPreferences.setScaledFonts(((JComponent) container).getComponents());
try {
container.setFont(AppPreferences.getScaledFont(containerEvent.getChild().getFont()));
container.revalidate();
container.repaint();
} catch (Exception e) {
}
}
if (container instanceof JOptionPane) {
JOptionPane pane = (JOptionPane) container;
if (HasIcon(pane)) {
ImageIcon icon;
switch(pane.getMessageType()) {
case JOptionPane.ERROR_MESSAGE:
icon = new ImageIcon(getClass().getClassLoader().getResource("resources/logisim/error.png"));
pane.setIcon(AppPreferences.getScaledImageIcon(icon, (float) 3));
break;
case JOptionPane.QUESTION_MESSAGE:
icon = new ImageIcon(getClass().getClassLoader().getResource("resources/logisim/question.png"));
pane.setIcon(AppPreferences.getScaledImageIcon(icon, (float) 3));
break;
case JOptionPane.PLAIN_MESSAGE:
icon = new ImageIcon(getClass().getClassLoader().getResource("resources/logisim/plain.png"));
pane.setIcon(AppPreferences.getScaledImageIcon(icon, (float) 3));
break;
case JOptionPane.INFORMATION_MESSAGE:
icon = new ImageIcon(getClass().getClassLoader().getResource("resources/logisim/info.png"));
pane.setIcon(AppPreferences.getScaledImageIcon(icon, (float) 3));
break;
case JOptionPane.WARNING_MESSAGE:
icon = new ImageIcon(getClass().getClassLoader().getResource("resources/logisim/warning.png"));
pane.setIcon(AppPreferences.getScaledImageIcon(icon, (float) 3));
break;
}
}
}
}
}
// TODO Auto-generated method stub
}
Aggregations