// ---------------------------------------------------------------------------- private JPanel createFontSelection() { JPanel panel = new JPanel(new GridLayout(1, 2, 10, 2)); panel.setBorder(new TitledBorder(new EtchedBorder(), "Font")); FontLoader loader = FontLoader.getInstance(); font_names_ = new OpenList(loader.getFontNames(), "Name:"); panel.add(font_names_); font_sizes_ = new OpenList(sizes_, "Size:"); panel.add(font_sizes_); ListSelectionListener lsel = new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { // System.out.println("MODIFICATION"); updatePreview(); } }; font_sizes_.setSelected("24"); font_names_.setSelected(loader.getFontNames()[0]); font_names_.addListSelectionListener(lsel); font_sizes_.addListSelectionListener(lsel); return panel; }
// ---------------------------------------------------------------------------- public AttributeSet getAttributes() { if (attributes_ != null) { StyleConstants.setFontFamily(attributes_, font_names_.getSelected()); StyleConstants.setFontSize(attributes_, font_sizes_.getSelectedInt()); } return attributes_; }
// ---------------------------------------------------------------------------- public void setDrawSWFFont(DrawSWFFont font) { font_names_.setSelected(font.getAWTFont().getFontName()); font_sizes_.setSelected(Integer.toString(font.getAWTFont().getSize())); effect_buttons_[font.getEffect()].setSelected(true); draw_font_ = font; text_field_.setText(font.getText()); color_button_.setColor(font.getColor()); updatePreview(); }
// ---------------------------------------------------------------------------- public void setAttributes(AttributeSet a) { attributes_ = new SimpleAttributeSet(a); String name = StyleConstants.getFontFamily(a); font_names_.setSelected(name); int size = StyleConstants.getFontSize(a); font_sizes_.setSelectedInt(size); updatePreview(); }
/** * Implements the driver for the Iterator design pattern example. * * <p>In this example, the concrete aggregate is a list that gets filled with five integer objects * (1 to 5). The, the <code>ReverseIterator</code> is created and used to print all elements in * reverse order. * * @param args command line paramters, unused */ public static void main(String[] args) { OpenList openList = new OpenList(); openList.append(new Integer(1)); openList.append(new Integer(2)); openList.append(new Integer(3)); openList.append(new Integer(4)); openList.append(new Integer(5)); System.out.println("List created, containing int objects 1, 2, 3, 4, 5."); Iterator iter = openList.createReverseIterator(); System.out.println("Using ReverseIterator to print list elements in reverse order..."); print(iter); System.out.println("done."); }
// ---------------------------------------------------------------------------- protected void updatePreview() { // FontContainer font = ((at.bestsolution.drawswf.fontdialog.FontContainer) // font_names_.getSelectedObject()); // System.out.println("FONT:" + font_names_.getSelected() ); String name = font_names_.getSelected(); int size = font_sizes_.getSelectedInt(); if (size > 0 && name != null) { Font real_font = FontLoader.getInstance().getFont(name, Font.PLAIN, size); text_field_.setFont(real_font); text_field_.repaint(); } draw_font_ = new DrawSWFFont( text_field_.getFont(), effect_, text_field_.getText(), color_button_.getColor()); fireStateChanged(); }