< prev index next >

src/demo/share/jfc/Font2DTest/RangeMenu.java

Print this page

        

*** 60,70 **** * @author Ankit Patel [Conversion to Swing - 01/07/30] */ /// Custom made choice menu that holds data for unicode range ! public final class RangeMenu extends JComboBox implements ActionListener { private static final int[][] UNICODE_RANGES = getUnicodeRanges(); private static final String[] UNICODE_RANGE_NAMES = getUnicodeRangeNames(); private boolean useCustomRange = false; --- 60,70 ---- * @author Ankit Patel [Conversion to Swing - 01/07/30] */ /// Custom made choice menu that holds data for unicode range ! public final class RangeMenu extends JComboBox<String> implements ActionListener { private static final int[][] UNICODE_RANGES = getUnicodeRanges(); private static final String[] UNICODE_RANGE_NAMES = getUnicodeRangeNames(); private boolean useCustomRange = false;
*** 179,203 **** /// itemStateChanged() method. Part of change to Swing. public void actionPerformed( ActionEvent e ) { Object source = e.getSource(); if ( source instanceof JComboBox ) { ! String rangeName = (String)((JComboBox)source).getSelectedItem(); if ( rangeName.equals("Custom...") ) { useCustomRange = true; customRangeDialog.setLocationRelativeTo(parent); ! customRangeDialog.show(); } else { useCustomRange = false; } parent.fireRangeChanged(); } else if ( source instanceof JButton ) { /// Since it is only "OK" button that sends any action here... ! customRangeDialog.hide(); } } private static int[][] getUnicodeRanges() { List<Integer> ranges = new ArrayList<>(); --- 179,203 ---- /// itemStateChanged() method. Part of change to Swing. public void actionPerformed( ActionEvent e ) { Object source = e.getSource(); if ( source instanceof JComboBox ) { ! String rangeName = (String)((JComboBox<?>)source).getSelectedItem(); if ( rangeName.equals("Custom...") ) { useCustomRange = true; customRangeDialog.setLocationRelativeTo(parent); ! customRangeDialog.setVisible(true); } else { useCustomRange = false; } parent.fireRangeChanged(); } else if ( source instanceof JButton ) { /// Since it is only "OK" button that sends any action here... ! customRangeDialog.setVisible(false); } } private static int[][] getUnicodeRanges() { List<Integer> ranges = new ArrayList<>();
< prev index next >