Search in sources :

Example 1 with JFontChooser

use of com.connectina.swing.fontchooser.JFontChooser 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
}
Also used : ContainerEvent(java.awt.event.ContainerEvent) JScrollPane(javax.swing.JScrollPane) ImageIcon(javax.swing.ImageIcon) JRadioButton(javax.swing.JRadioButton) JComboBox(javax.swing.JComboBox) JTabbedPane(javax.swing.JTabbedPane) CanvasPane(com.cburch.logisim.gui.generic.CanvasPane) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) JTextField(javax.swing.JTextField) JOptionPane(javax.swing.JOptionPane) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) URISyntaxException(java.net.URISyntaxException) FileNotFoundException(java.io.FileNotFoundException) LoadFailedException(com.cburch.logisim.file.LoadFailedException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) JCheckBox(javax.swing.JCheckBox) JFileChooser(javax.swing.JFileChooser) JFontChooser(com.connectina.swing.fontchooser.JFontChooser) JSpinner(javax.swing.JSpinner) Component(java.awt.Component) JComponent(javax.swing.JComponent) JMenuItem(javax.swing.JMenuItem) JMenu(javax.swing.JMenu) JHelp(javax.help.JHelp)

Aggregations

LoadFailedException (com.cburch.logisim.file.LoadFailedException)1 CanvasPane (com.cburch.logisim.gui.generic.CanvasPane)1 JFontChooser (com.connectina.swing.fontchooser.JFontChooser)1 Component (java.awt.Component)1 ContainerEvent (java.awt.event.ContainerEvent)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 URISyntaxException (java.net.URISyntaxException)1 JHelp (javax.help.JHelp)1 ImageIcon (javax.swing.ImageIcon)1 JButton (javax.swing.JButton)1 JCheckBox (javax.swing.JCheckBox)1 JCheckBoxMenuItem (javax.swing.JCheckBoxMenuItem)1 JComboBox (javax.swing.JComboBox)1 JComponent (javax.swing.JComponent)1 JFileChooser (javax.swing.JFileChooser)1 JLabel (javax.swing.JLabel)1 JMenu (javax.swing.JMenu)1 JMenuItem (javax.swing.JMenuItem)1