super(new GridBagLayout()); initCountryIcons(); setBorder(BorderFactory.createTitledBorder (BorderFactory.createEtchedBorder(), resources.getString("Panel.title"))); BorderFactory.createLoweredBevelBorder())); sp.getViewport().add(languageList); this.add(sp, constraints); BorderFactory.createLoweredBevelBorder())); sp2.getViewport().add(userList); this.add(sp2, constraints); constraints.weightx = 0; constraints.weighty = 0; this.add(new JLabel(resources.getString("InfoLabel.text")), constraints); this.add(t, constraints);
languagePanel.setLanguages(model.getString(PREFERENCE_KEY_LANGUAGES));
/** * Builds the Language panel. */ protected JPanel buildLanguagePanel() { JPanel p = new JPanel(); p.setBorder(BorderFactory.createEmptyBorder(16, 16, 16, 16)); languagePanel = new LanguageDialog.Panel(); languagePanel.setBorder(BorderFactory.createEmptyBorder()); Color c = UIManager.getColor("Window.background"); languagePanel.getComponent(0).setBackground(c); languagePanel.getComponent(1).setBackground(c); p.add(languagePanel); return p; }
languagePanel.setLanguages(model.getString(PREFERENCE_KEY_LANGUAGES));
languagePanel.getLanguages()); model.setString(PREFERENCE_KEY_USER_STYLESHEET, userStylesheet.getText());
languagePanel.getLanguages()); model.setString(PREFERENCE_KEY_USER_STYLESHEET, userStylesheet.getText());
super(new GridBagLayout()); initCountryIcons(); setBorder(BorderFactory.createTitledBorder (BorderFactory.createEtchedBorder(), resources.getString("Panel.title"))); BorderFactory.createLoweredBevelBorder())); sp.getViewport().add(languageList); this.add(sp, constraints); BorderFactory.createLoweredBevelBorder())); sp2.getViewport().add(userList); this.add(sp2, constraints); constraints.weightx = 0; constraints.weighty = 0; this.add(new JLabel(resources.getString("InfoLabel.text")), constraints); this.add(t, constraints);
/** * Allows to pre-initialize icons used by the <code>Panel</code> * constructor. It is not neccessary to call it and it should * be called only once. * This method is safe to be called by another thread than the * event thread as it doesn't manipulate Swing <code>JComponent</code> * instances. */ public static synchronized void initCountryIcons() { // don't need to init several times... if (iconMap == null) { iconMap = new HashMap(); StringTokenizer st; st = new StringTokenizer(resources.getString("Country.list"), " "); while (st.hasMoreTokens()) { computeCountryIcon(LanguageDialog.Panel.class, st.nextToken()); } } }
/** * Allows to pre-initialize icons used by the <code>Panel</code> * constructor. It is not neccessary to call it and it should * be called only once. * This method is safe to be called by another thread than the * event thread as it doesn't manipulate Swing <code>JComponent</code> * instances. */ public static synchronized void initCountryIcons() { // don't need to init several times... if (iconMap == null) { iconMap = new HashMap(); StringTokenizer st; st = new StringTokenizer(resources.getString("Country.list"), " "); while (st.hasMoreTokens()) { computeCountryIcon(LanguageDialog.Panel.class, st.nextToken()); } } }
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus){ String s = (String)value; this.setText(getCountryText(s)); this.setIcon(getCountryIcon(s)); this.setEnabled(list.isEnabled()); this.setFont(list.getFont()); if (isSelected) { this.setBackground(list.getSelectionBackground()); this.setForeground(list.getSelectionForeground()); } else { this.setBackground(list.getBackground()); this.setForeground(list.getForeground()); } return this; } }
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus){ String s = (String)value; this.setText(getCountryText(s)); this.setIcon(getCountryIcon(s)); this.setEnabled(list.isEnabled()); this.setFont(list.getFont()); if (isSelected) { this.setBackground(list.getSelectionBackground()); this.setForeground(list.getSelectionForeground()); } else { this.setBackground(list.getBackground()); this.setForeground(list.getForeground()); } return this; } }
/** * Builds the Language panel. */ protected JPanel buildLanguagePanel() { JPanel p = new JPanel(); p.setBorder(BorderFactory.createEmptyBorder(16, 16, 16, 16)); languagePanel = new LanguageDialog.Panel(); languagePanel.setBorder(BorderFactory.createEmptyBorder()); Color c = UIManager.getColor("Window.background"); languagePanel.getComponent(0).setBackground(c); languagePanel.getComponent(1).setBackground(c); p.add(languagePanel); return p; }
/** * returns the icon associated with a country code. */ protected Icon getCountryIcon(String code) { return computeCountryIcon(getClass(), code); }
/** * returns the icon associated with a country code. */ protected Icon getCountryIcon(String code) { return computeCountryIcon(getClass(), code); }
/** * Returns the user languages. */ public String getLanguages() { return panel.getLanguages(); }
/** * Sets the user languages. */ public void setLanguages(String s) { panel.setLanguages(s); }
/** * Returns the user languages. */ public String getLanguages() { return panel.getLanguages(); }
/** * Sets the user languages. */ public void setLanguages(String s) { panel.setLanguages(s); }