List of usage examples for java.awt.event ItemEvent SELECTED
int SELECTED
To view the source code for java.awt.event ItemEvent SELECTED.
Click Source Link
From source file:schoolsystem.FeeModule.java
private void radio_fee_module_chequeItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_radio_fee_module_chequeItemStateChanged int change = evt.getStateChange(); if (change == ItemEvent.SELECTED) { lbl_cheque.setVisible(true);/*w w w.j a v a2s. com*/ txt_fee_module_cheque_no.setVisible(true); } else { lbl_cheque.setVisible(false); txt_fee_module_cheque_no.setVisible(false); } }
From source file:org.geopublishing.atlasStyler.swing.PolygonSymbolEditGUI.java
/** * This method initializes jComboBox1/*from w w w . j a va 2s .c o m*/ * * @return javax.swing.JComboBox */ private JComboBox getJComboBoxStrokeWidth() { if (jComboBoxStrokeWidth == null) { jComboBoxStrokeWidth = new JComboBox(); jComboBoxStrokeWidth.setModel(new DefaultComboBoxModel(WIDTH_VALUES)); jComboBoxStrokeWidth.setRenderer(WIDTH_VALUES_RENDERER); // TODO .. might not be in list... Stroke s = symbolizer.getStroke(); if (s != null) if (s.getWidth() == null) { // Having a Stroke but no StrokeWidth doesn't make sense. s.setWidth(ASUtil.ff2.literal("1.")); } else { ASUtil.selectOrInsert(jComboBoxStrokeWidth, s.getWidth()); } else { jComboBoxStrokeWidth.setEnabled(false); } jComboBoxStrokeWidth.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { symbolizer.getStroke().setWidth(ASUtil.ff2.literal(e.getItem())); PolygonSymbolEditGUI.this.firePropertyChange(PROPERTY_UPDATED, null, null); } } }); SwingUtil.addMouseWheelForCombobox(jComboBoxStrokeWidth); } return jComboBoxStrokeWidth; }
From source file:ru.goodfil.catalog.ui.forms.FilterWindow.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Sasha aaa contentPanel = new JPanel(); label16 = new JLabel(); label17 = new JLabel(); label18 = new JLabel(); label1 = new JLabel(); cbFilterType = new JComboBox(); label5 = new JLabel(); tbAParam = new JTextField(); label2 = new JLabel(); cbFilterForm = new JComboBox(); label6 = new JLabel(); tbBParam = new JTextField(); label3 = new JLabel(); tbName = new JTextField(); label7 = new JLabel(); tbCParam = new JTextField(); label4 = new JLabel(); panel2 = new JPanel(); tbImage = new JTextField(); btnUploadImage = new JButton(); label8 = new JLabel(); tbDParam = new JTextField(); label19 = new JLabel(); cbFilterStatus = new JComboBox(); label9 = new JLabel(); tbEParam = new JTextField(); label15 = new JLabel(); scrollPane1 = new JScrollPane(); tbAdditionalInfo = new JTextArea(); label10 = new JLabel(); tbFParam = new JTextField(); label11 = new JLabel(); tbGParam = new JTextField(); label12 = new JLabel(); tbHParam = new JTextField(); label13 = new JLabel(); tbPbParam = new JTextField(); label14 = new JLabel(); tbNrParam = new JTextField(); panel1 = new JPanel(); okButton = new JButton(); cancelButton = new JButton(); CellConstraints cc = new CellConstraints(); //======== this ======== setModal(true);//from w w w. j a v a2 s.c om setTitle("\u0424\u0438\u043b\u044c\u0442\u0440"); Container contentPane = getContentPane(); contentPane.setLayout(new FormLayout("default:grow", "fill:default:grow")); //======== contentPanel ======== { // JFormDesigner evaluation mark contentPanel.setBorder(new javax.swing.border.CompoundBorder( new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0), "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red), contentPanel.getBorder())); contentPanel.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent e) { if ("border".equals(e.getPropertyName())) throw new RuntimeException(); } }); contentPanel.setLayout(new FormLayout( "$rgap, default, $lcgap, default:grow, $lcgap, right:20dlu, $lcgap, default:grow, $rgap", "13*(default, $lgap), fill:default:grow, $lgap, default")); //---- label16 ---- label16.setText( "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0435. "); contentPanel.add(label16, cc.xywh(2, 1, 7, 1)); //---- label17 ---- label17.setText( "\u041f\u043e\u043b\u044f, \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u0432\u0435\u0437\u0434\u043e\u0447\u043a\u0430\u043c\u0438, \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f."); contentPanel.add(label17, cc.xywh(2, 3, 7, 1)); //---- label18 ---- label18.setText( "\u0427\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0438\u043f \u0438\u043b\u0438 \u0444\u043e\u0440\u043c\u0443 \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 \"\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b\"->\"\u0422\u0438\u043f\u044b \u0438 \u0444\u043e\u0440\u043c\u044b \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\""); label18.setForeground(Color.blue); contentPanel.add(label18, cc.xywh(2, 5, 7, 1)); //---- label1 ---- label1.setText("\u0422\u0438\u043f*"); contentPanel.add(label1, cc.xy(2, 7)); contentPanel.add(cbFilterType, cc.xy(4, 7)); //---- label5 ---- label5.setText("A"); contentPanel.add(label5, cc.xy(6, 7)); contentPanel.add(tbAParam, cc.xy(8, 7)); //---- label2 ---- label2.setText("\u0424\u043e\u0440\u043c\u0430*"); contentPanel.add(label2, cc.xy(2, 9)); contentPanel.add(cbFilterForm, cc.xy(4, 9)); //---- label6 ---- label6.setText("B"); contentPanel.add(label6, cc.xy(6, 9)); contentPanel.add(tbBParam, cc.xy(8, 9)); //---- label3 ---- label3.setText("\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435*"); contentPanel.add(label3, cc.xy(2, 11)); //---- tbName ---- tbName.addKeyListener(new KeyAdapter() { @Override public void keyTyped(KeyEvent e) { tbNameKeyTyped(e); } }); tbName.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { tbNameFocusGained(e); } @Override public void focusLost(FocusEvent e) { tbNameFocusGained(e); } }); contentPanel.add(tbName, cc.xy(4, 11)); //---- label7 ---- label7.setText("C"); contentPanel.add(label7, cc.xy(6, 11)); contentPanel.add(tbCParam, cc.xy(8, 11)); //---- label4 ---- label4.setText("\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435"); contentPanel.add(label4, cc.xy(2, 13)); //======== panel2 ======== { panel2.setLayout(new FormLayout("default:grow, $lcgap, default", "default")); panel2.add(tbImage, cc.xy(1, 1)); //---- btnUploadImage ---- btnUploadImage.setText("..."); btnUploadImage.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnUploadImageActionPerformed(); } }); panel2.add(btnUploadImage, cc.xy(3, 1)); } contentPanel.add(panel2, cc.xy(4, 13)); //---- label8 ---- label8.setText("D"); contentPanel.add(label8, cc.xy(6, 13)); contentPanel.add(tbDParam, cc.xy(8, 13)); //---- label19 ---- label19.setText("\u0421\u0442\u0430\u0442\u0443\u0441"); contentPanel.add(label19, cc.xy(2, 15)); //---- cbFilterStatus ---- cbFilterStatus.setModel(new DefaultComboBoxModel(new String[] { "\u0412 \u041f\u0420\u041e\u0418\u0417\u0412\u041e\u0414\u0421\u0422\u0412\u0415", "\u041f\u041e\u0421\u0422\u0410\u0412\u041b\u042f\u0415\u0422\u0421\u042f", "\u041d\u0415 \u041f\u041e\u0421\u0422\u0410\u0412\u041b\u042f\u0415\u0422\u0421\u042f" })); contentPanel.add(cbFilterStatus, cc.xy(4, 15)); //---- label9 ---- label9.setText("E"); contentPanel.add(label9, cc.xy(6, 15)); contentPanel.add(tbEParam, cc.xy(8, 15)); //---- label15 ---- label15.setText("\u0414\u043e\u043f. \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f"); contentPanel.add(label15, cc.xy(2, 17)); //======== scrollPane1 ======== { scrollPane1.setViewportView(tbAdditionalInfo); } contentPanel.add(scrollPane1, cc.xywh(4, 17, 1, 11)); //---- label10 ---- label10.setText("F"); contentPanel.add(label10, cc.xy(6, 17)); contentPanel.add(tbFParam, cc.xy(8, 17)); //---- label11 ---- label11.setText("G"); contentPanel.add(label11, cc.xy(6, 19)); contentPanel.add(tbGParam, cc.xy(8, 19)); //---- label12 ---- label12.setText("H"); contentPanel.add(label12, cc.xy(6, 21)); contentPanel.add(tbHParam, cc.xy(8, 21)); //---- label13 ---- label13.setText("PB"); contentPanel.add(label13, cc.xy(6, 23)); contentPanel.add(tbPbParam, cc.xy(8, 23)); //---- label14 ---- label14.setText("NR"); contentPanel.add(label14, cc.xy(6, 25)); contentPanel.add(tbNrParam, cc.xy(8, 25)); //======== panel1 ======== { panel1.setLayout(new FormLayout("default:grow, 2*($lcgap, $button)", "default")); //---- okButton ---- okButton.setText("OK"); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { okButtonActionPerformed(e); } }); panel1.add(okButton, cc.xy(3, 1)); //---- cancelButton ---- cancelButton.setText("\u041e\u0442\u043c\u0435\u043d\u0430"); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cancelButtonActionPerformed(e); } }); panel1.add(cancelButton, cc.xy(5, 1)); } contentPanel.add(panel1, cc.xywh(2, 29, 7, 1)); } contentPane.add(contentPanel, cc.xy(1, 1)); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents cbFilterType.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { SelectItem selectItem = (SelectItem) e.getItem(); FilterType ft = carsService.getFilterTypeByCode(selectItem.getId()); reReadFilterForms(ft.getCode()); } } }); cbFilterForm.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { adjustParameters(); adjustButtonsEnabled(); } } }); }
From source file:schoolsystem.FeePanel.java
private void radio_fee_module_chequeItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_radio_fee_module_chequeItemStateChanged int change = evt.getStateChange(); if (change == ItemEvent.SELECTED) { lbl_pay_no.setVisible(true);/*from w ww .ja v a 2 s. c o m*/ txt_fee_no.setVisible(true); lbl_pay_no.setText("Enter Cheque No."); } else { lbl_pay_no.setVisible(false); lbl_pay_no.setText("Enter Cheque No."); txt_fee_no.setVisible(false); } }
From source file:com.peterbochs.sourceleveldebugger.SourceLevelDebugger3.java
private void initGUI() { try {/*from w ww . j a v a 2s . c o m*/ this.setPreferredSize(new java.awt.Dimension(975, 563)); { jMainSplitPane = new JSplitPane(); this.add(getJErrorLabel(), "errorLabel"); this.add(jMainSplitPane, "MAIN"); jMainSplitPane.setDividerLocation(200); { jPanel4 = new JPanel(); jMainSplitPane.add(jPanel4, JSplitPane.RIGHT); BorderLayout jPanel4Layout = new BorderLayout(); jPanel4.setLayout(jPanel4Layout); { jSplitPane3 = new JSplitPane(); jPanel4.add(jSplitPane3, BorderLayout.CENTER); jSplitPane3.setOrientation(JSplitPane.VERTICAL_SPLIT); jSplitPane3.setDividerLocation(500); { jPanel6 = new JPanel(); jSplitPane3.add(jPanel6, JSplitPane.TOP); jSplitPane3.add(getJInfoTabbedPane(), JSplitPane.BOTTOM); BorderLayout jPanel6Layout = new BorderLayout(); jPanel6.setLayout(jPanel6Layout); { jMainTabbedPane = new JMaximizableTabbedPane(); jPanel6.add(jMainTabbedPane, BorderLayout.CENTER); { jASMPanel = new JPanel(); jMainTabbedPane.addTab(MyLanguage.getString("ASM/C"), null, jASMPanel, null); jMainTabbedPane.addTab("Dwarf", null, getJDwarfPanel(), null); jMainTabbedPane.addTab("Code base", null, getCodeBasePanel(), null); jMainTabbedPane.addTab("Call Graph", null, getCallGraphPanel(), null); BorderLayout jASMPanelLayout = new BorderLayout(); jASMPanel.setLayout(jASMPanelLayout); { instructionTableScrollPane = new JScrollPane(); instructionTableScrollPane.getVerticalScrollBar() .addAdjustmentListener(new AdjustmentListener() { boolean isRunning; public void adjustmentValueChanged(AdjustmentEvent evt) { /* JScrollBar vbar = (JScrollBar) evt.getSource(); if (evt.getValueIsAdjusting()) { return; } if ((vbar.getValue() + vbar.getVisibleAmount()) == vbar.getMaximum()) { if (!isRunning) { try { isRunning = true; final CardLayout cl = (CardLayout) (peterBochsDebugger.jMainPanel.getLayout()); cl.show(peterBochsDebugger.jMainPanel, "Running Label"); // new Thread("update instruction thread") { // public void run() { // long address = Long.parseLong(instructionTable.getValueAt(instructionTable.getRowCount() - 1, 1).toString() // .substring(2), 16); // peterBochsDebugger.updateInstruction(address, true); // peterBochsDebugger.updateBreakpointTableColor(); //// cl.show(peterBochsDebugger.jMainPanel, peterBochsDebugger.currentPanel); // // isRunning = false; // } // }.start(); } catch (Exception ex) { } } }*/ } }); jASMPanel.add(instructionTableScrollPane, BorderLayout.CENTER); { instructionTable = new JTable(); instructionTableScrollPane.setViewportView(instructionTable); instructionTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); instructionTable .setModel(PeterBochsDebugger.instructionTable.getModel()); instructionTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); instructionTable.getTableHeader().setReorderingAllowed(false); instructionTable.getColumnModel().getColumn(0).setMaxWidth(20); instructionTable.getColumnModel().getColumn(1).setPreferredWidth(40); instructionTable.getColumnModel().getColumn(2).setPreferredWidth(200); instructionTable.getColumnModel().getColumn(3).setPreferredWidth(40); instructionTable.setShowGrid(false); instructionTable.setDefaultRenderer(String.class, new InstructionTableCellRenderer()); instructionTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { instructionTableMouseClicked(evt); } }); } } { jInstructionControlPanel = new JPanel(); jASMPanel.add(jInstructionControlPanel, BorderLayout.NORTH); { jInstructionComboBox = new JComboBox(); jInstructionControlPanel.add(jInstructionComboBox); jInstructionComboBox.setEditable(true); jInstructionComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jInstructionComboBoxActionPerformed(evt); } }); } { disassembleButton = new JButton(); jInstructionControlPanel.add(disassembleButton); disassembleButton.setText(MyLanguage.getString("Disassemble")); disassembleButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { disassembleButtonActionPerformed(evt); } }); } { disassembleCSEIPButton = new JButton(); jInstructionControlPanel.add(disassembleCSEIPButton); disassembleCSEIPButton .setText(MyLanguage.getString("Disassemble") + " cs:eip"); disassembleCSEIPButton.setEnabled(true); disassembleCSEIPButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { disassembleCSEIPButtonActionPerformed(evt); } }); } { jInstructionUpTenButton = new JButton(); jInstructionControlPanel.add(jInstructionUpTenButton); jInstructionUpTenButton .setIcon(new ImageIcon(getClass().getClassLoader().getResource( "com/peterbochs/icons/famfam_icons/arrow_up10.png"))); jInstructionUpTenButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jInstructionUpTenButtonActionPerformed(evt); } }); } { jInstructionUpButton = new JButton(); jInstructionControlPanel.add(jInstructionUpButton); jInstructionUpButton .setIcon(new ImageIcon(getClass().getClassLoader().getResource( "com/peterbochs/icons/famfam_icons/arrow_up1.png"))); jInstructionUpButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jInstructionUpButtonActionPerformed(evt); } }); } { jInstructionDownButton = new JButton(); jInstructionControlPanel.add(jInstructionDownButton); jInstructionDownButton .setIcon(new ImageIcon(getClass().getClassLoader().getResource( "com/peterbochs/icons/famfam_icons/arrow_down.png"))); jInstructionDownButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jInstructionDownButtonActionPerformed(evt); } }); } { jDiskButton = new JButton(); jInstructionControlPanel.add(jDiskButton); jDiskButton.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("com/peterbochs/icons/famfam_icons/disk.png"))); jDiskButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButton3ActionPerformed(evt); } }); } { jExcelButton = new JButton(); jInstructionControlPanel.add(jExcelButton); jInstructionControlPanel.add(getJSearchTextField()); jExcelButton.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("com/peterbochs/icons/famfam_icons/excel.gif"))); { btnSearch = new JButton("Search"); jInstructionControlPanel.add(btnSearch); btnSearch.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { btnSearchActionPerformed(evt); } }); } { onOffButton = new OnOffButton(); onOffButton.setSelected(true); onOffButton.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { InstructionTableModel model = (InstructionTableModel) PeterBochsDebugger.instructionTable .getModel(); if (e.getStateChange() == ItemEvent.SELECTED) { model.showAsmLevel = true; } else { model.showAsmLevel = false; } model.fireTableDataChanged(); } }); onOffButton.setPreferredSize(new Dimension(53, 18)); jInstructionControlPanel.add(onOffButton); } jExcelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButton12ActionPerformed(evt); } }); } } } } } } } { jPanel1 = new JPanel(); jMainSplitPane.add(jPanel1, JSplitPane.LEFT); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); { jTabbedPane1 = new JMaximizableTabbedPane(); jPanel1.add(jTabbedPane1, BorderLayout.CENTER); jTabbedPane1.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { jTabbedPane1StateChanged(evt); } }); { jPanel3 = new JPanel(); BorderLayout jPanel3Layout = new BorderLayout(); jPanel3.setLayout(jPanel3Layout); jTabbedPane1.addTab("Symbol", null, getSymbolTablePanel(), null); jTabbedPane1.addTab(MyLanguage.getString("Project"), null, jPanel3, null); { jScrollPane1 = new JScrollPane(); jPanel3.add(jScrollPane1, BorderLayout.CENTER); jPanel3.add(getJProjectToolBar(), BorderLayout.NORTH); { projectTree = new JTree(); jScrollPane1.setViewportView(projectTree); projectTree.setModel(projectFilterTreeModel); projectTree.setShowsRootHandles(true); projectTree.setCellRenderer(new ProjectTreeRenderer()); projectTree.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { projectTreeMouseClicked(evt); } }); } } } } } } } catch (Exception e) { e.printStackTrace(); } }
From source file:schoolsystem.FeeModule.java
private void radio_fee_module_receiptItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_radio_fee_module_receiptItemStateChanged int change = evt.getStateChange(); if (change == ItemEvent.SELECTED) { lbl_receipt.setVisible(true);// w ww .jav a2s .c o m txt_fee_module_receipt.setVisible(true); } else { lbl_receipt.setVisible(false); txt_fee_module_receipt.setVisible(false); } }
From source file:org.smart.migrate.ui.MappingDialog.java
private void cbxSourceTablesItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbxSourceTablesItemStateChanged if (evt.getStateChange() == ItemEvent.SELECTED) { String tableName = (String) cbxSourceTables.getSelectedItem(); autoMatchTargetTable(tableName); if (migratePlan.getSourceDB().getdBType() == DBType.Excel) { ExcelUtils.addIndendityColumnData(migratePlan.getSourceDB().getDatabase(), tableName); }/*ww w.j av a 2 s .c o m*/ initFieldMappings(); cbxSourceTables.setToolTipText(tableName); } }
From source file:schoolsystem.FeePanel.java
private void radio_fee_module_receiptItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_radio_fee_module_receiptItemStateChanged int change = evt.getStateChange(); if (change == ItemEvent.SELECTED) { lbl_pay_no.setVisible(true);//from w w w .j a va 2 s.co m txt_fee_no.setVisible(true); } else { lbl_pay_no.setVisible(false); txt_fee_no.setVisible(false); } }
From source file:org.tellervo.desktop.tridasv2.ui.ComponentViewerOld.java
private void setupTreeGUI() { treeLayout = new TreeLayout<String, Integer>(graph); radialLayout = new BalloonLayout<String, Integer>(graph); radialLayout.setSize(new Dimension(600, 600)); vv = new VisualizationViewer<String, Integer>(treeLayout, new Dimension(600, 600)); vv.setBackground(Color.white); vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line()); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller()); // add a listener for ToolTips vv.setVertexToolTipTransformer(new ToStringLabeller()); vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray)); vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.E); rings = new Rings(radialLayout); Container content = tree2Panel; final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); content.add(panel);//from w w w . j av a2 s . com final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse(); vv.setGraphMouse(graphMouse); JComboBox modeBox = graphMouse.getModeComboBox(); modeBox.addItemListener(graphMouse.getModeListener()); graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); JToggleButton radial = new JToggleButton("Radial"); radial.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { LayoutTransition<String, Integer> lt = new LayoutTransition<String, Integer>(vv, treeLayout, radialLayout); Animator animator = new Animator(lt); animator.start(); vv.getRenderContext().getMultiLayerTransformer().setToIdentity(); vv.addPreRenderPaintable(rings); } else { LayoutTransition<String, Integer> lt = new LayoutTransition<String, Integer>(vv, radialLayout, treeLayout); Animator animator = new Animator(lt); animator.start(); vv.getRenderContext().getMultiLayerTransformer().setToIdentity(); vv.removePreRenderPaintable(rings); } vv.repaint(); } }); JPanel scaleGrid = new JPanel(new GridLayout(1, 0)); scaleGrid.setBorder(BorderFactory.createTitledBorder("Zoom")); JPanel controls = new JPanel(); scaleGrid.add(plus); scaleGrid.add(minus); controls.add(radial); controls.add(scaleGrid); controls.add(modeBox); content.add(controls, BorderLayout.SOUTH); }
From source file:de.tor.tribes.ui.windows.ReportRulesDialog.java
private void fireRuleTypeChangedEvent(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_fireRuleTypeChangedEvent if (evt == null || evt.getStateChange() == ItemEvent.SELECTED) { int idx = jRuleSelection.getSelectedIndex(); jRuleSettingsPanel.invalidate(); jRuleSettingsPanel.removeAll();//from ww w .j a va 2 s . c o m switch (idx) { case 0: jRuleSettingsPanel.add(jReportColorPanel, BorderLayout.CENTER); break; case 1: jRuleSettingsPanel.add(jDatePanel, BorderLayout.CENTER); break; case 2: jRuleSettingsPanel.add(jAgePanel, BorderLayout.CENTER); break; case 3: jRuleSettingsPanel.add(jAttackerPanel, BorderLayout.CENTER); break; case 4: jRuleSettingsPanel.add(jDefenderPanel, BorderLayout.CENTER); break; case 5: jRuleSettingsPanel.add(jAttackerAllyPanel, BorderLayout.CENTER); break; case 6: jRuleSettingsPanel.add(jDefenderAllyPanel, BorderLayout.CENTER); break; case 7: jRuleSettingsPanel.add(jNoSettingsPanel, BorderLayout.CENTER); jNoSettingsType.setText("OFF"); break; case 8: jRuleSettingsPanel.add(jNoSettingsPanel, BorderLayout.CENTER); jNoSettingsType.setText("FAKE"); break; case 9: jRuleSettingsPanel.add(jNoSettingsPanel, BorderLayout.CENTER); jNoSettingsType.setText("SNOB"); break; case 10: jRuleSettingsPanel.add(jNoSettingsPanel, BorderLayout.CENTER); jNoSettingsType.setText("WALL"); break; case 11: jRuleSettingsPanel.add(jNoSettingsPanel, BorderLayout.CENTER); jNoSettingsType.setText("BUILDING"); break; } jRuleSettingsPanel.revalidate(); pack(); repaint(); } }