/** Creates new form ValuesDialog */ public StylesDialog(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); applyI18n(); this.setSize(490, 250); // DefaultTableColumnModel dtcm = (DefaultTableColumnModel)jTableParameters.getColumnModel(); // DefaultTableCellRenderer tcr = // (DefaultTableCellRenderer)dtcm.getColumn(0).getHeaderRenderer(); // new DefaultTableCellRenderer(); // tcr.setFont(jTableParameters.getFont()); // tcr.setBackground(this.getBackground()); // tcr.setBorder( new javax.swing.border.BevelBorder( javax.swing.border.BevelBorder.RAISED)); // dtcm.getColumn(0).setHeaderRenderer(tcr); DefaultListSelectionModel dlsm = (DefaultListSelectionModel) this.jTableParameters.getSelectionModel(); dlsm.addListSelectionListener( new javax.swing.event.ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { jTableParametersListSelectionValueChanged(e); } }); // Open in center... it.businesslogic.ireport.util.Misc.centerFrame(this); DefaultTableModel dtm = (DefaultTableModel) jTableParameters.getModel(); it.businesslogic.ireport.gui.MainFrame.getMainInstance() .getActiveReportFrame() .getReport() .addStyleChangedListener(this); Enumeration e = it.businesslogic.ireport.gui.MainFrame.getMainInstance() .getActiveReportFrame() .getReport() .getStyles() .elements(); while (e.hasMoreElements()) { Style style = (Style) e.nextElement(); addStyle(style); } DefaultTableColumnModel dtcm = (DefaultTableColumnModel) jTableParameters.getColumnModel(); dtcm.getColumn(0).setPreferredWidth(350); dtcm.getColumn(1).setPreferredWidth(100); javax.swing.KeyStroke escape = javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0, false); javax.swing.Action escapeAction = new javax.swing.AbstractAction() { public void actionPerformed(java.awt.event.ActionEvent e) { setVisible(false); } }; getRootPane().getInputMap(javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(escape, "ESCAPE"); getRootPane().getActionMap().put("ESCAPE", escapeAction); }
/** * Constructor * * @param model the via list model. Must not be null. * @param selectionModel the selection model. Must not be null. */ public ViaList(ViaListModel model, DefaultListSelectionModel selectionModel) { super(model); this.model = model; setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); setSelectionModel(selectionModel); setCellRenderer(new OsmPrimitivRenderer()); setDragEnabled(true); setTransferHandler(transferHandler = new ViaListTransferHandler(model)); setVisibleRowCount(4); actDelete = new DeleteAction(); selectionModel.addListSelectionListener(actDelete); registerKeyboardAction( actDelete, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); actMoveDown = new MoveDownAction(); selectionModel.addListSelectionListener(actMoveDown); registerKeyboardAction( actMoveDown, KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.ALT_DOWN_MASK), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); actMoveUp = new MoveUpAction(); selectionModel.addListSelectionListener(actMoveUp); registerKeyboardAction( actMoveUp, KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.ALT_DOWN_MASK), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); actCopy = new CopyAction(); actPaste = new PasteAction(); getSelectionModel().addListSelectionListener(actCopy); addMouseListener(new ViaListPopupMenuLaucher()); }
public JRTabStopsPropertyCustomEditor(Object value, PropertyEditor editor, PropertyEnv env) { this.env = env; this.editor = editor; this.env.setState(PropertyEnv.STATE_NEEDS_VALIDATION); this.env.addPropertyChangeListener(this); initComponents(); Tag[] tags = new Tag[] { new Tag( TabStopAlignEnum.LEFT.getValueByte(), I18n.getString("AbstractStyleNode.Property.Left")), new Tag( TabStopAlignEnum.CENTER.getValueByte(), I18n.getString("AbstractStyleNode.Property.Center")), new Tag( TabStopAlignEnum.RIGHT.getValueByte(), I18n.getString("AbstractStyleNode.Property.Right")) }; jTableProperties.getColumnModel().getColumn(1).setCellEditor(new ComboBoxEditor(tags)); jTableProperties.getColumnModel().getColumn(1).setCellRenderer(new ComboBoxRenderer(tags)); DefaultListSelectionModel dlsm = (DefaultListSelectionModel) this.jTableProperties.getSelectionModel(); dlsm.addListSelectionListener( new javax.swing.event.ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { jTablePropertiesListSelectionValueChanged(e); } }); if (value instanceof List && value != null) { setTabStops((List) value); } }