List of usage examples for javax.swing DefaultComboBoxModel DefaultComboBoxModel
public DefaultComboBoxModel()
From source file:de.tor.tribes.ui.views.DSWorkbenchDoItYourselfAttackPlaner.java
@Override public void resetView() { AttackManager.getSingleton().addManagerListener(this); //setup renderer and general view // ((DoItYourselfAttackTableModel) jAttackTable.getModel()).clear(); HighlightPredicate.ColumnHighlightPredicate colu = new HighlightPredicate.ColumnHighlightPredicate(0, 1, 2, 3, 6);/*ww w .ja v a2 s . c o m*/ jAttackTable.setRowHeight(24); jAttackTable.getTableHeader().setDefaultRenderer(new DefaultTableHeaderRenderer()); jAttackTable.setHighlighters(new CompoundHighlighter(colu, HighlighterFactory.createAlternateStriping(Constants.DS_ROW_A, Constants.DS_ROW_B))); jAttackTable.setColumnControlVisible(true); jAttackTable.setDefaultEditor(UnitHolder.class, new UnitCellEditor()); jAttackTable.setDefaultEditor(Village.class, new VillageCellEditor()); jAttackTable.setDefaultRenderer(UnitHolder.class, new UnitCellRenderer()); jAttackTable.setDefaultRenderer(Integer.class, new NoteIconCellRenderer(NoteIconCellRenderer.ICON_TYPE.NOTE)); jAttackTable.setDefaultRenderer(Date.class, new ColoredDateCellRenderer()); jAttackTable.setDefaultRenderer(Long.class, new ColoredCoutdownCellRenderer()); jAttackTable.setDefaultEditor(Date.class, new DateSpinEditor()); jAttackTable.setDefaultEditor(Integer.class, new NoteIconCellEditor(NoteIconCellEditor.ICON_TYPE.NOTE)); BufferedImage back = ImageUtils.createCompatibleBufferedImage(5, 5, BufferedImage.BITMASK); Graphics2D g = back.createGraphics(); GeneralPath p = new GeneralPath(); p.moveTo(0, 0); p.lineTo(5, 0); p.lineTo(5, 5); p.closePath(); g.setColor(Color.GREEN.darker()); g.fill(p); g.dispose(); jAttackTable.addHighlighter(new PainterHighlighter(HighlightPredicate.EDITABLE, new ImagePainter(back, HorizontalAlignment.RIGHT, VerticalAlignment.TOP))); DefaultComboBoxModel model = new DefaultComboBoxModel(); DefaultComboBoxModel model2 = new DefaultComboBoxModel(); for (UnitHolder unit : DataHolder.getSingleton().getUnits()) { model.addElement(unit); model2.addElement(unit); } jUnitBox.setModel(model); jUnitComboBox.setModel(model2); jUnitBox.setSelectedItem(DataHolder.getSingleton().getUnitByPlainName("ram")); jUnitComboBox.setSelectedItem(DataHolder.getSingleton().getUnitByPlainName("ram")); jUnitBox.setRenderer(new UnitListCellRenderer()); jAttackTypeComboBox.setRenderer(new StandardAttackListCellRenderer()); DefaultComboBoxModel typeModel = new DefaultComboBoxModel(); for (ManageableType t : StandardAttackManager.getSingleton().getAllElements()) { StandardAttack a = (StandardAttack) t; typeModel.addElement(a); } jAttackTypeComboBox.setModel(typeModel); jUnitComboBox.setRenderer(new UnitListCellRenderer()); jSourceVillage.setValue(new Point(500, 500)); jTargetVillage.setValue(new Point(500, 500)); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { jSourceVillage.updateUI(); jTargetVillage.updateUI(); } }); }
From source file:edu.ku.brc.specify.config.init.TaxonLoadSetupPanel.java
@Override public void doingNext() { super.doingNext(); DisciplineType disciplineType = (DisciplineType) properties.get("disciplineType"); if (disciplineType != null) { DefaultComboBoxModel model = new DefaultComboBoxModel(); Vector<TaxonFileDesc> taxonFileDescs = readTaxonLoadFiles(); if (taxonFileDescs != null) { for (TaxonFileDesc tfd : taxonFileDescs) { if (tfd.getDiscipline().equals(disciplineType.getName())) { model.addElement(tfd); }/* www.ja v a 2s. co m*/ } fileCBX.setModel(model); if (model.getSize() > 0) { fileCBX.setSelectedIndex(0); } if (firstTime) { firstTime = false; fileCBX.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { fileSelected(); } }); } fileSelected(); } else { fileCBX.setEnabled(false); preloadChk.setEnabled(false); } } }
From source file:de.tor.tribes.ui.views.DSWorkbenchDistanceFrame.java
public void resetView(boolean pClear) { if (pClear) { DistanceManager.getSingleton().clear(); }/*from w w w . jav a 2 s . co m*/ jDistanceTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); int w0 = 200; for (int i = 0; i < jDistanceTable.getColumnCount(); i++) { TableColumnExt column = jDistanceTable.getColumnExt(i); if (i == 0) { column.setWidth(w0); column.setPreferredWidth(w0); column.setMaxWidth(w0); column.setMinWidth(w0); column.setResizable(false); } else { String v = (String) column.getHeaderValue(); int w = getGraphics().getFontMetrics().stringWidth(v); column.setWidth(w); column.setPreferredWidth(w); } } jDistanceTable.getTableHeader().setDefaultRenderer(new DefaultTableHeaderRenderer()); if (pClear) { ((DistanceTableModel) jDistanceTable.getModel()).fireTableStructureChanged(); } else { ((DistanceTableModel) jDistanceTable.getModel()).fireTableDataChanged(); } DefaultComboBoxModel model = new DefaultComboBoxModel(); model.addElement(UnknownUnit.getSingleton()); for (UnitHolder unit : DataHolder.getSingleton().getUnits()) { model.addElement(unit); } unitBox.setModel(model); }
From source file:com.declarativa.interprolog.gui.ListenerWindow.java
private void graphComponents() throws IOException { Forest<String, Integer> forest = new DelegateForest<>(); Forest<String, Integer> forest2 = new DelegateForest<>(); Forest<String, Integer> forest3 = new DelegateForest<>(); //ObservableGraph g = new ObservableGraph(new BalloonLayoutDemo().createTree(forest)); ObservableGraph g = new ObservableGraph(new GraphGenerator().createTree(forest)); ObservableGraph g2 = new ObservableGraph(new GraphGenerator().createTree2(forest2)); ObservableGraph g3 = new ObservableGraph(new GraphGenerator().createTree3(forest3)); //Layout layout = new BalloonLayout(forest); Layout layout = new BalloonLayout(forest); Layout layout2 = new BalloonLayout(forest2); Layout layout3 = new TreeLayout(forest3, 70, 70); final BaseJungScene scene = new SceneImpl(g, layout); final BaseJungScene scene2 = new SceneImpl(g2, layout2); final BaseJungScene scene3 = new SceneImpl(g3, layout3); jLayeredPane1.setLayout(new BorderLayout()); //jf.setLayout(new BorderLayout()); jLayeredPane5.setLayout(new BorderLayout()); jLayeredPane8.setLayout(new BorderLayout()); jLayeredPane1.add(new JScrollPane(scene.createView()), BorderLayout.CENTER); //jf.add(new JScrollPane(scene2.createView()), BorderLayout.CENTER); jLayeredPane5.add(new JScrollPane(scene2.createView()), BorderLayout.CENTER); jLayeredPane8.add(new JScrollPane(scene3.createView()), BorderLayout.CENTER); JToolBar bar = new JToolBar(); bar.setMargin(new Insets(5, 5, 5, 5)); bar.setLayout(new FlowLayout(5)); DefaultComboBoxModel<Layout> mdl = new DefaultComboBoxModel<>(); mdl.addElement(new KKLayout(g)); mdl.addElement(layout);/*from ww w. j ava 2 s . c o m*/ mdl.addElement(new BalloonLayout(forest)); mdl.addElement(new RadialTreeLayout(forest)); mdl.addElement(new CircleLayout(g)); mdl.addElement(new FRLayout(g)); mdl.addElement(new FRLayout2(g)); mdl.addElement(new ISOMLayout(g)); mdl.addElement(new edu.uci.ics.jung.algorithms.layout.SpringLayout(g)); mdl.addElement(new SpringLayout2(g)); mdl.addElement(new DAGLayout(g)); mdl.addElement(new XLayout(g)); mdl.setSelectedItem(layout); final JCheckBox checkbox = new JCheckBox("Animate iterative layouts"); scene.setLayoutAnimationFramesPerSecond(48); scene2.setLayoutAnimationFramesPerSecond(48); scene3.setLayoutAnimationFramesPerSecond(48); final JComboBox<Layout> layouts = new JComboBox(mdl); layouts.setRenderer(new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList<?> jlist, Object o, int i, boolean bln, boolean bln1) { o = o.getClass().getSimpleName(); return super.getListCellRendererComponent(jlist, o, i, bln, bln1); //To change body of generated methods, choose Tools | Templates. } }); bar.add(new JLabel(" Layout Type")); bar.add(layouts); layouts.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { Layout layout = (Layout) layouts.getSelectedItem(); // These two layouts implement IterativeContext, but they do // not evolve toward anything, they just randomly rearrange // themselves. So disable animation for these. if (layout instanceof ISOMLayout || layout instanceof DAGLayout) { checkbox.setSelected(false); } scene.setGraphLayout(layout, true); } }); bar.add(new JLabel(" Connection Shape")); DefaultComboBoxModel<Transformer<Context<Graph<String, Number>, Number>, Shape>> shapes = new DefaultComboBoxModel<>(); shapes.addElement(new EdgeShape.QuadCurve<String, Number>()); shapes.addElement(new EdgeShape.BentLine<String, Number>()); shapes.addElement(new EdgeShape.CubicCurve<String, Number>()); shapes.addElement(new EdgeShape.Line<String, Number>()); shapes.addElement(new EdgeShape.Box<String, Number>()); shapes.addElement(new EdgeShape.Orthogonal<String, Number>()); shapes.addElement(new EdgeShape.Wedge<String, Number>(10)); final JComboBox<Transformer<Context<Graph<String, Number>, Number>, Shape>> shapesBox = new JComboBox<>( shapes); shapesBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { Transformer<Context<Graph<String, Number>, Number>, Shape> xform = (Transformer<Context<Graph<String, Number>, Number>, Shape>) shapesBox .getSelectedItem(); scene.setConnectionEdgeShape(xform); } }); shapesBox.setRenderer(new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList<?> jlist, Object o, int i, boolean bln, boolean bln1) { o = o.getClass().getSimpleName(); return super.getListCellRendererComponent(jlist, o, i, bln, bln1); //To change body of generated methods, choose Tools | Templates. } }); shapesBox.setSelectedItem(new EdgeShape.QuadCurve<>()); bar.add(shapesBox); //jf.add(bar, BorderLayout.NORTH); bar.add(new ListenerWindow.MinSizePanel(scene.createSatelliteView())); bar.setFloatable(false); bar.setRollover(true); final JLabel selectionLabel = new JLabel("<html> </html>"); System.out.println("LOOKUP IS " + scene.getLookup()); Lookup.Result<String> selectedNodes = scene.getLookup().lookupResult(String.class); LookupListener listener = new LookupListener() { @Override public void resultChanged(LookupEvent le) { System.out.println("RES CHANGED"); Lookup.Result<String> res = (Lookup.Result<String>) le.getSource(); StringBuilder sb = new StringBuilder("<html>"); List<String> l = new ArrayList<>(res.allInstances()); Collections.sort(l); for (String s : l) { if (sb.length() != 0) { sb.append(", "); } sb.append(s); } sb.append("</html>"); selectionLabel.setText(sb.toString()); System.out.println("LOOKUP EVENT " + sb); } }; selectedNodes.addLookupListener(listener); selectedNodes.allInstances(); bar.add(selectionLabel); checkbox.setSelected(true); checkbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { scene.setAnimateIterativeLayouts(checkbox.isSelected()); } }); bar.add(checkbox); jLayeredPane3.setLayout(new BorderLayout()); jLayeredPane6.setLayout(new BorderLayout()); jLayeredPane3.add(bar); jLayeredPane6.add(bar); // jf.setSize(jf.getGraphicsConfiguration().getBounds().width - 120, 700); // jf.setSize(new Dimension(1280, 720)); // jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent we) { scene.relayout(true); scene.validate(); scene2.relayout(true); scene2.validate(); scene3.relayout(true); scene3.validate(); } }); }
From source file:be.nbb.demetra.dfm.output.simulation.RealTimePerspGraphView.java
private void updateComboBox() { if (dfmSimulation.isPresent()) { comboBox.setModel(toComboBoxModel(dfmSimulation.get().getDescriptions())); comboBox.setEnabled(true);/* ww w .ja v a 2 s. c om*/ } else { comboBox.setModel(new DefaultComboBoxModel()); comboBox.setEnabled(false); } }
From source file:com.mirth.connect.connectors.ws.WebServiceSender.java
private void loadServiceMap() { // First reset the service/port/operation serviceComboBox.setModel(new DefaultComboBoxModel()); portComboBox.setModel(new DefaultComboBoxModel()); locationURIComboBox.setModel(new DefaultComboBoxModel()); operationComboBox.setModel(new DefaultComboBoxModel( new String[] { WebServiceDispatcherProperties.WEBSERVICE_DEFAULT_DROPDOWN })); if (currentServiceMap != null) { serviceComboBox.setModel(new DefaultComboBoxModel(currentServiceMap.getMap().keySet().toArray())); }//w w w. j a v a2 s .c o m }
From source file:com.mirth.connect.client.ui.panels.export.MessageExportPanel.java
private void initComponents() { contentComboBox.setToolTipText(// w w w. j a v a2s. c o m "<html>The content that will be exported: Either the entire message serialized into XML, or a specific content type<br />from either the source connector message or the destination connector messages.</html>"); encryptCheckBox.setToolTipText("<html>If checked, the exported message content will be encrypted.</html>"); attachmentsCheckBox.setToolTipText( "<html>If checked and the content type is set to XML serialized message,<br/>the exported message will contain any attachments.</html>"); compressComboBox.setToolTipText( "<html>When compression is enabled, the files/folders created according to the<br />File Pattern will be put into a compressed file in the Root Path.</html>"); exportServerRadio.setToolTipText( "<html>Store exported files on the Mirth Connect Server, in the Root Path specified below.</html>"); exportLocalRadio.setToolTipText( "<html>Store exported files on this computer, in the Root Path specified below.</html>"); rootPathTextField.setToolTipText( "<html>The root path to store the exported files/folders or compressed file.<br/>Relative paths will be resolved against the Mirth Connect Server home directory.</html>"); filePatternTextPane.setToolTipText( "<html>The file/folder pattern in which to write the exported message files.<br />Variables from the Variables list to the right may be used in the pattern.</html>"); archiverBlockSizeField.setToolTipText( "<html>The number of messages that will be cached by the archiver. Increase this value<br/>to improve performance. Decrease this value to reduce memory usage. This value<br/>must be between 1 and 1000. The recommended value for most servers is 50.</html>"); archiveYes = new MirthRadioButton("Yes"); archiveNo = new MirthRadioButton("No"); DefaultComboBoxModel model = new DefaultComboBoxModel(); model.addElement(XML_EXPORT_FORMAT); model.addElement(new ExportFormat(false, "Source", ContentType.RAW)); model.addElement(new ExportFormat(false, "Source", ContentType.PROCESSED_RAW)); model.addElement(new ExportFormat(false, "Source", ContentType.TRANSFORMED)); model.addElement(new ExportFormat(false, "Source", ContentType.ENCODED)); model.addElement(new ExportFormat(false, "Source", ContentType.RESPONSE)); model.addElement(new ExportFormat(true, "Destination", ContentType.RAW)); model.addElement(new ExportFormat(true, "Destination", ContentType.TRANSFORMED)); model.addElement(new ExportFormat(true, "Destination", ContentType.ENCODED)); model.addElement(new ExportFormat(true, "Destination", ContentType.SENT)); model.addElement(new ExportFormat(true, "Destination", ContentType.RESPONSE)); model.addElement(new ExportFormat(true, "Destination", ContentType.PROCESSED_RESPONSE)); model.addElement(new ExportFormat(false, "", ContentType.SOURCE_MAP)); model.addElement(new ExportFormat(false, "", ContentType.CHANNEL_MAP)); model.addElement(new ExportFormat(false, "", ContentType.RESPONSE_MAP)); contentComboBox.setModel(model); contentComboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (!contentComboBox.getSelectedItem().toString().equalsIgnoreCase(XML_EXPORT_FORMAT)) { attachmentsCheckBox.setEnabled(false); attachmentsCheckBox.setSelected(false); } else { attachmentsCheckBox.setEnabled(true); } } }); model = new DefaultComboBoxModel(); model.addElement(NO_COMPRESSION); for (ArchiveFormat archiveFormat : ArchiveFormat.values()) { model.addElement(archiveFormat); } compressComboBox.setModel(model); ArrayList<String> variables = new ArrayList<String>(); variables.add("Message ID"); variables.add("Server ID"); variables.add("Channel ID"); variables.add("Original File Name"); variables.add("Formatted Message Date"); variables.add("Formatted Current Date"); variables.add("Timestamp"); variables.add("Unique ID"); variables.add("Count"); varListScrollPane.setBackground(UIConstants.BACKGROUND_COLOR); varListPanel.setBackground(UIConstants.BACKGROUND_COLOR); varListPanel.setBorder(BorderFactory.createEmptyBorder()); varListPanel.setLayout(new BorderLayout()); varListPanel.add(varListScrollPane); varListScrollPane.setViewportView(varList); varList.setListData(variables.toArray()); archiveButtonGroup.add(archiveYes); archiveButtonGroup.add(archiveNo); archiveYes.setSelected(true); archiverBlockSizeField.setDocument(new MirthFieldConstraints(4, false, false, true)); if (archiverMode) { rootPathExtLabel.setText("/" + ARCHIVER_MODE_PATTERN + "/"); } else { rootPathExtLabel.setVisible(false); } exportButtonGroup.add(exportServerRadio); exportButtonGroup.add(exportLocalRadio); exportServerRadio.setSelected(true); browseButton.setEnabled(false); filePatternTextPane.setText("message_${message.messageId}.xml"); filePatternScrollPane.setViewportView(filePatternTextPane); // this is the list of components that will be disabled when the archive radio "No" is selected, see archiveChanged() archiveComponents = new Component[] { archiverBlockSizeLabel, archiverBlockSizeField, contentLabel, contentComboBox, encryptCheckBox, attachmentsCheckBox, varList, varListScrollPane, varListPanel, compressLabel, compressComboBox, exportToLabel, exportServerRadio, exportLocalRadio, browseButton, rootPathLabel, rootPathTextField, rootPathExtLabel, filePatternLabel, filePatternScrollPane, filePatternTextPane }; // @formatter:off archiveYes.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { archiveChanged(); } }); archiveNo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { archiveChanged(); } }); compressComboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { compressComboBoxChanged(); } }); browseButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { browseSelected(); } }); exportServerRadio.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { exportDestinationChanged(); } }); exportLocalRadio.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { exportDestinationChanged(); } }); // @formatter:on }
From source file:at.nhmwien.schema_mapping_tool.ProcessMappingWindow.java
/** Creates new form ProcessMappingWindow */ public ProcessMappingWindow() { initComponents();/*from w w w.j a va2 s . co m*/ // Disable the abort button by default this.abortButton.setEnabled(false); // Add the available file types to the dropdown String[] fpTypes = ProcessorHandler.self().getProcessors(); DefaultComboBoxModel iffCbModel = new DefaultComboBoxModel(); DefaultComboBoxModel offCbModel = new DefaultComboBoxModel(); for (int i = 0; i < fpTypes.length; i++) { iffCbModel.addElement(fpTypes[i]); offCbModel.addElement(fpTypes[i]); // Get all valid file-types for this handler and add a filenameextensionfilter for it /*String[] fpFileTypes = ProcessorHandler.self().getSupportedFilesForType(fpTypes[i]); if( fpFileTypes != null ) { String fpFTDescription = fpTypes[i] + " (*." + fpFileTypes[0]; for( int j = 1; j < fpFileTypes.length; j++ ) { fpFTDescription += ", *." + fpFileTypes[j]; } fpFTDescription += ")"; //FileNameExtensionFilter filter = new FileNameExtensionFilter( fpFTDescription, fpFileTypes ); //fc.addChoosableFileFilter(filter); }*/ } this.inputFileFormatComboBox.setModel(iffCbModel); this.outputFileFormatComboBox.setModel(offCbModel); // Add all available character encodings to the drop-down DefaultComboBoxModel ifECbModel = new DefaultComboBoxModel(); DefaultComboBoxModel ofECbModel = new DefaultComboBoxModel(); SortedMap<String, Charset> availChars = Charset.availableCharsets(); Iterator<Map.Entry<String, Charset>> acIt = availChars.entrySet().iterator(); while (acIt.hasNext()) { Map.Entry<String, Charset> currEntry = acIt.next(); ifECbModel.addElement(currEntry.getValue()); ofECbModel.addElement(currEntry.getValue()); } this.ifEncodingComboBox.setModel(ifECbModel); this.ofEncodingComboBox.setModel(ofECbModel); this.mp = new MappingProcess(); // Create our initial settings windows inputFileFormatComboBoxActionPerformed(null); outputFileFormatComboBoxActionPerformed(null); }
From source file:eu.dety.burp.joseph.attacks.key_confusion.KeyConfusionInfo.java
@Override public boolean getExtraUI(JPanel extraPanel, GridBagConstraints constraints) { // Create combobox and textarea to add public key (in different formats) JLabel publicKeyLabel = new JLabel(bundle.getString("PUBKEY_FORMAT")); publicKeySelection = new JComboBox<>(); DefaultComboBoxModel<String> publicKeySelectionListModel = new DefaultComboBoxModel<>(); publicKey = new JTextArea(10, 50); publicKey.setLineWrap(true);// w w w . java 2 s . co m publicKeySelectionListModel.addElement("PEM (String)"); publicKeySelectionListModel.addElement("JWK (JSON)"); publicKeySelection.setModel(publicKeySelectionListModel); constraints.gridy = 0; extraPanel.add(publicKeyLabel, constraints); constraints.gridy = 1; extraPanel.add(publicKeySelection, constraints); constraints.gridy = 2; JScrollPane jScrollPane = new javax.swing.JScrollPane(); jScrollPane.setViewportView(publicKey); extraPanel.add(jScrollPane, constraints); return true; }
From source file:com.declarativa.interprolog.gui.Ini.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try {/*from w ww . j ava 2 s . c o m*/ Forest<String, Integer> forest = new DelegateForest<>(); ObservableGraph g = new ObservableGraph(new BalloonLayoutDemo().createTree(forest)); Layout layout = new BalloonLayout(forest); //Layout layout = new TreeLayout(forest, 70, 70); final BaseJungScene scene = new SceneImpl(g, layout); jLayeredPane1.setLayout(new BorderLayout()); jLayeredPane1.add(new JScrollPane(scene.createView()), BorderLayout.CENTER); final JCheckBox checkbox = new JCheckBox("Animate iterative layouts"); scene.setLayoutAnimationFramesPerSecond(48); //********************** DefaultComboBoxModel<Transformer<Context<Graph<String, Number>, Number>, Shape>> shapes = new DefaultComboBoxModel<>(); shapes.addElement(new EdgeShape.QuadCurve<String, Number>()); shapes.addElement(new EdgeShape.BentLine<String, Number>()); shapes.addElement(new EdgeShape.CubicCurve<String, Number>()); shapes.addElement(new EdgeShape.Line<String, Number>()); shapes.addElement(new EdgeShape.Box<String, Number>()); shapes.addElement(new EdgeShape.Orthogonal<String, Number>()); shapes.addElement(new EdgeShape.Wedge<String, Number>(10)); /* final JComboBox<Transformer<Context<Graph<String, Number>, Number>, Shape>> shapesBox = new JComboBox<>(shapes); shapesBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { Transformer<Context<Graph<String, Number>, Number>, Shape> xform = (Transformer<Context<Graph<String, Number>, Number>, Shape>) shapesBox.getSelectedItem(); scene.setConnectionEdgeShape(xform); } }); shapesBox.setRenderer(new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList<?> jlist, Object o, int i, boolean bln, boolean bln1) { o = o.getClass().getSimpleName(); return super.getListCellRendererComponent(jlist, o, i, bln, bln1); //To change body of generated methods, choose Tools | Templates. } }); shapesBox.setSelectedItem(new EdgeShape.QuadCurve<>()); */ final JLabel selectionLabel = new JLabel("<html> </html>"); System.out.println("LOOKUP IS " + scene.getLookup()); Lookup.Result<String> selectedNodes = scene.getLookup().lookupResult(String.class); LookupListener listener = new LookupListener() { @Override public void resultChanged(LookupEvent le) { System.out.println("RES CHANGED"); Lookup.Result<String> res = (Lookup.Result<String>) le.getSource(); StringBuilder sb = new StringBuilder("<html>"); List<String> l = new ArrayList<>(res.allInstances()); Collections.sort(l); for (String s : l) { if (sb.length() != 0) { sb.append(", "); } sb.append(s); } sb.append("</html>"); selectionLabel.setText(sb.toString()); System.out.println("LOOKUP EVENT " + sb); } }; selectedNodes.addLookupListener(listener); selectedNodes.allInstances(); checkbox.setSelected(true); checkbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { scene.setAnimateIterativeLayouts(checkbox.isSelected()); } }); jLayeredPane1.setSize(456, 458); //// jf.setSize(jf.getGraphicsConfiguration().getBounds().width - 120, 700); this.addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent we) { scene.relayout(true); scene.validate(); } }); /* int returnVal = fileChooser.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); fileChooser.addChoosableFileFilter(new FileFilter() { public String getDescription() { return "Prolog native program (*.P)"; } public boolean accept(File f) { if (f.isDirectory()) { return true; } else { return f.getName().toLowerCase().endsWith(".P"); } } }); try { // What to do with the file, e.g. display it in a TextArea prologOutput.read(new FileReader(file.getAbsolutePath()), null); } catch (IOException ex) { System.out.println("problem accessing file" + file.getAbsolutePath()); } } else { System.out.println("File access cancelled by user."); } */ //One file chooser for each buton click } catch (IOException ex) { Exceptions.printStackTrace(ex); System.out.println("AUCH"); } }