List of usage examples for javax.swing JCheckBox addItemListener
public void addItemListener(ItemListener l)
ItemListener
to the checkbox
. From source file:com.declarativa.interprolog.gui.ListenerWindow.java
private void UpdategraphComponents() throws IOException { jLayeredPane1.removeAll();//from w w w .j a va 2 s . c om List<String> heads = new ArrayList<>(); List<String> subgrph = new ArrayList<>(); ArgBuildManager manag = new ArgBuildManager(); Forest<String, Integer> graphGUI = new DelegateForest<>(); graphGUI = manag.getGraphJung(); System.out.println("\t \t NUM UF VERT:" + graphGUI.getVertexCount()); Forest<String, Integer> forest = new DelegateForest<>(); //ObservableGraph g = new ObservableGraph(new BalloonLayoutDemo().createTree(forest)); ObservableGraph g = new ObservableGraph(graphGUI); //Layout layout = new BalloonLayout(forest); Layout layout = new BalloonLayout(graphGUI); //Layout layout = new TreeLayout(forest, 70, 70); final BaseJungScene scene2 = new SceneImpl(g, layout); // jLayeredPane1.setLayout(new BorderLayout()); //jf.setLayout(new BorderLayout()); jLayeredPane1.add(new JScrollPane(scene2.createView()), BorderLayout.CENTER); //jf.add(new JScrollPane(scene2.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); 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"); scene2.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); } scene2.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(); scene2.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(scene2.createSatelliteView())); bar.setFloatable(false); bar.setRollover(true); final JLabel selectionLabel = new JLabel("<html> </html>"); System.out.println("LOOKUP IS " + scene2.getLookup()); Lookup.Result<String> selectedNodes = scene2.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) { scene2.setAnimateIterativeLayouts(checkbox.isSelected()); } }); bar.add(checkbox); jLayeredPane3.setLayout(new BorderLayout()); jLayeredPane3.add(bar); // jf.setSize(jf.getGraphicsConfiguration().getBounds().width - 120, 700); // jf.setSize(new Dimension(1280, 720)); // jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.repaint(); this.addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent we) { scene2.relayout(true); scene2.validate(); } }); }
From source file:com.declarativa.interprolog.gui.ListenerWindow.java
private void UpdategraphComponents(Forest<String, Integer> graph) throws IOException { jLayeredPane1.removeAll();//from w ww . j a v a 2 s . c o m /* List<String> heads = new ArrayList<>(); List<String> subgrph = new ArrayList<>(); ArgBuildManager manag = new ArgBuildManager(); Forest<String, Integer> graphGUI = new DelegateForest<>(); graphGUI = manag.getGraphJung(); */ Forest<String, Integer> graphGUI = new DelegateForest<>(); graphGUI = graph; System.out.println("\t \t NUM UF VERT:" + graphGUI.getVertexCount()); //ObservableGraph g = new ObservableGraph(new BalloonLayoutDemo().createTree(forest)); ObservableGraph g = new ObservableGraph(graphGUI); //Layout layout = new BalloonLayout(forest); Layout layout = new BalloonLayout(graphGUI); //Layout layout = new TreeLayout(forest, 70, 70); final BaseJungScene scene2 = new SceneImpl(g, layout); jLayeredPane1.setLayout(new BorderLayout()); //jf.setLayout(new BorderLayout()); jLayeredPane1.add(new JScrollPane(scene2.createView()), BorderLayout.CENTER); //jf.add(new JScrollPane(scene2.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); 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"); scene2.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); } scene2.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(); scene2.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(scene2.createSatelliteView())); bar.setFloatable(false); bar.setRollover(true); final JLabel selectionLabel = new JLabel("<html> </html>"); System.out.println("LOOKUP IS " + scene2.getLookup()); Lookup.Result<String> selectedNodes = scene2.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) { scene2.setAnimateIterativeLayouts(checkbox.isSelected()); } }); bar.add(checkbox); jLayeredPane3.setLayout(new BorderLayout()); jLayeredPane3.add(bar); // jf.setSize(jf.getGraphicsConfiguration().getBounds().width - 120, 700); // jf.setSize(new Dimension(1280, 720)); // jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); // this.repaint(); this.addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent we) { scene2.relayout(true); scene2.validate(); } }); }
From source file:com.declarativa.interprolog.gui.ListenerWindow.java
private void UpdategraphComponents2(Forest<String, Integer> graph) throws IOException { jLayeredPane5.removeAll();//w w w . ja va 2 s. co m /* List<String> heads = new ArrayList<>(); List<String> subgrph = new ArrayList<>(); ArgBuildManager manag = new ArgBuildManager(); Forest<String, Integer> graphGUI = new DelegateForest<>(); graphGUI = manag.getGraphJung(); */ Forest<String, Integer> graphGUI = new DelegateForest<>(); graphGUI = graph; System.out.println("\t \t NUM UF VERT:" + graphGUI.getVertexCount()); //ObservableGraph g = new ObservableGraph(new BalloonLayoutDemo().createTree(forest)); ObservableGraph g = new ObservableGraph(graphGUI); //Layout layout = new BalloonLayout(forest); Layout layout = new BalloonLayout(graphGUI); //Layout layout = new TreeLayout(forest, 70, 70); final BaseJungScene scene2 = new SceneImpl(g, layout); jLayeredPane5.setLayout(new BorderLayout()); //jf.setLayout(new BorderLayout()); jLayeredPane5.add(new JScrollPane(scene2.createView()), BorderLayout.CENTER); //jf.add(new JScrollPane(scene2.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); 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"); scene2.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); } scene2.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(); scene2.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(scene2.createSatelliteView())); bar.setFloatable(false); bar.setRollover(true); final JLabel selectionLabel = new JLabel("<html> </html>"); System.out.println("LOOKUP IS " + scene2.getLookup()); Lookup.Result<String> selectedNodes = scene2.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) { scene2.setAnimateIterativeLayouts(checkbox.isSelected()); } }); bar.add(checkbox); jLayeredPane6.setLayout(new BorderLayout()); jLayeredPane6.add(bar); // jf.setSize(jf.getGraphicsConfiguration().getBounds().width - 120, 700); // jf.setSize(new Dimension(1280, 720)); // jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); // this.repaint(); this.addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent we) { scene2.relayout(true); scene2.validate(); } }); }
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);// w ww . ja va2 s . co 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:org.cagrid.installer.steps.PresentLicenseStep.java
public void init(WizardModel m) { this.model = (CaGridInstallerModel) m; setLayout(new BorderLayout()); setSize(new Dimension(475, 161)); JPanel licensePanel = new JPanel(); licensePanel.setBackground(Color.WHITE); JTextPane textPane = new JTextPane(); licensePanel.add(textPane);/*from w w w. java 2s . c o m*/ JScrollPane scrollPane = new JScrollPane(licensePanel); scrollPane.setPreferredSize(new Dimension(475, 150)); add(scrollPane, BorderLayout.CENTER); try { StringBuilder sb = new StringBuilder(); BufferedReader r = new BufferedReader( new InputStreamReader(getClass().getResourceAsStream("/cagrid_license.txt"))); String line = null; while ((line = r.readLine()) != null) { sb.append(line).append("\n"); } textPane.setText(sb.toString()); textPane.setFont(textPane.getFont().deriveFont((float) 10)); } catch (Exception ex) { String msg = "Error loading license: " + ex.getMessage(); logger.error(msg, ex); JOptionPane.showMessageDialog(null, msg, this.model.getMessage("error"), JOptionPane.ERROR_MESSAGE); } JPanel controlPanel = new JPanel(); controlPanel.setLayout(new GridBagLayout()); add(controlPanel, BorderLayout.SOUTH); JLabel label = new JLabel(this.model.getMessage("accept.license")); controlPanel.add(label); JCheckBox checkBox = new JCheckBox(); checkBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent evt) { PresentLicenseStep.this.setComplete(evt.getStateChange() == ItemEvent.SELECTED); } }); controlPanel.add(checkBox); }
From source file:org.domainmath.gui.MainFrame.java
public void exitApp() { int j = fileTab.getTabCount() - 1; while (j != -1) { askSave(j);// w w w .j a va 2s. c o m j--; } ShutDown shutDown = new ShutDown(this, "DomainMath IDE", "Really do you want to exit?"); JButton yes = new JButton("Yes"); JButton no = new JButton("No"); JCheckBox confirmation = shutDown.getCheckBox(); Preferences pr2 = Preferences.userNodeForPackage(this.getClass()); boolean skipConfirmation = pr2.getBoolean("skip_confirmation", false); confirmation.addItemListener((ItemEvent e) -> { if (ItemEvent.DESELECTED == e.getStateChange()) { pr2.putBoolean("skip_confirmation", false); } else { pr2.putBoolean("skip_confirmation", true); } }); yes.addActionListener((ActionEvent e) -> { exitFinal(shutDown); }); no.addActionListener((ActionEvent e) -> { shutDown.dispose(); }); if (false == skipConfirmation) { shutDown.addButton(yes); shutDown.addButton(no); shutDown.setVisible(true); } else { exitFinal(shutDown); } }
From source file:org.ecoinformatics.seek.ecogrid.CheckBoxTableCellRenderer.java
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { jTable = table;//from w ww .j a va 2s. co m JPanel cellPanel = new JPanel(); cellPanel.setBorder(new LineBorder(Color.lightGray, 1)); cellPanel.setBackground(Color.WHITE); cellPanel.setPreferredSize( new Dimension(ServicesDisplayPanel.CELLPREFERREDWIDTH, ServicesDisplayPanel.HEIGHT)); SelectableDocumentType selectedDocumentType = null; boolean isChecked = false; boolean isEnable = true; String text = null; if (value != null && value instanceof SelectableObjectInterface) { SelectableObjectInterface selectedObj = (SelectableObjectInterface) value; text = selectedObj.getSelectableObjectLabel(); isChecked = selectedObj.getIsSelected(); isEnable = selectedObj.getEnabled(); } /* * label = (JLabel)renderer.getTableCellRendererComponent(table, text, * isSelected, hasFocus, row, column); */ JLabel label = new JLabel(text); label.setFont(new Font(FONTNAME, Font.PLAIN, FONTSIZE)); label.setPreferredSize(new Dimension(ServicesDisplayPanel.LABELPREFERWIDTH, ServicesDisplayPanel.HEIGHT)); // set a check box name String checkBoxName = "" + topRowNum + SEPERATOR + row; JCheckBox checkBox = new JCheckBox(); checkBox.setName(checkBoxName); checkBox.setBackground(Color.WHITE); checkBox.setSelected(isChecked); CheckBoxListener listener = new CheckBoxListener(); checkBox.addItemListener(listener); // checkBox.setEnabled(false); /* * if (topRowNum != DEFAUTTOPROW ) { // for sub table we need to set up * check box enable status checkBox.setEnabled(isEnable); }//if */ // add the label and checkbox to jpanel which has a border layout // manager BorderLayout layoutManager = new BorderLayout(); cellPanel.setLayout(layoutManager); cellPanel.add(label, BorderLayout.CENTER); cellPanel.add(checkBox, BorderLayout.WEST); return cellPanel; }
From source file:org.languagetool.gui.ConfigurationDialog.java
private void createOfficeElements(GridBagConstraints cons, JPanel portPanel) { int numParaCheck = config.getNumParasToCheck(); JRadioButton[] radioButtons = new JRadioButton[3]; ButtonGroup numParaGroup = new ButtonGroup(); radioButtons[0] = new JRadioButton(Tools.getLabel(messages.getString("guiCheckOnlyParagraph"))); radioButtons[0].setActionCommand("ParagraphCheck"); radioButtons[1] = new JRadioButton(Tools.getLabel(messages.getString("guiCheckFullText"))); radioButtons[1].setActionCommand("FullTextCheck"); radioButtons[2] = new JRadioButton(Tools.getLabel(messages.getString("guiCheckNumParagraphs"))); radioButtons[2].setActionCommand("NParagraphCheck"); radioButtons[2].setSelected(true);//from w w w. ja v a 2s .c o m JTextField numParaField = new JTextField(Integer.toString(5), 2); numParaField.setEnabled(radioButtons[2].isSelected()); numParaField.setMinimumSize(new Dimension(30, 25)); for (int i = 0; i < 3; i++) { numParaGroup.add(radioButtons[i]); } if (numParaCheck == 0) { radioButtons[0].setSelected(true); numParaField.setEnabled(false); } else if (numParaCheck < 0) { radioButtons[1].setSelected(true); numParaField.setEnabled(false); } else { radioButtons[2].setSelected(true); numParaField.setText(Integer.toString(numParaCheck)); numParaField.setEnabled(true); } radioButtons[0].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { numParaField.setEnabled(false); config.setNumParasToCheck(0); } }); radioButtons[1].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { numParaField.setEnabled(false); config.setNumParasToCheck(-1); } }); radioButtons[2].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int numParaCheck = Integer.parseInt(numParaField.getText()); if (numParaCheck < 1) numParaCheck = 1; else if (numParaCheck > 99) numParaCheck = 99; config.setNumParasToCheck(numParaCheck); numParaField.setForeground(Color.BLACK); numParaField.setText(Integer.toString(numParaCheck)); numParaField.setEnabled(true); } }); numParaField.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { changedUpdate(e); } @Override public void removeUpdate(DocumentEvent e) { changedUpdate(e); } @Override public void changedUpdate(DocumentEvent e) { try { int numParaCheck = Integer.parseInt(numParaField.getText()); if (numParaCheck > 0 && numParaCheck < 99) { numParaField.setForeground(Color.BLACK); config.setNumParasToCheck(numParaCheck); } else { numParaField.setForeground(Color.RED); } } catch (NumberFormatException ex) { numParaField.setForeground(Color.RED); } } }); JLabel textChangedLabel = new JLabel(Tools.getLabel(messages.getString("guiTextChangeLabel"))); cons.gridy++; portPanel.add(textChangedLabel, cons); cons.gridy++; cons.insets = new Insets(0, 30, 0, 0); for (int i = 0; i < 3; i++) { portPanel.add(radioButtons[i], cons); if (i < 2) cons.gridy++; } cons.gridx = 1; portPanel.add(numParaField, cons); JCheckBox noMultiResetbox = new JCheckBox(Tools.getLabel(messages.getString("guiNoMultiReset"))); noMultiResetbox.setSelected(config.isNoMultiReset()); noMultiResetbox.setEnabled(config.isResetCheck()); noMultiResetbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { config.setNoMultiReset(noMultiResetbox.isSelected()); } }); JCheckBox resetCheckbox = new JCheckBox(Tools.getLabel(messages.getString("guiDoResetCheck"))); resetCheckbox.setSelected(config.isResetCheck()); resetCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { config.setDoResetCheck(resetCheckbox.isSelected()); noMultiResetbox.setEnabled(resetCheckbox.isSelected()); } }); cons.insets = new Insets(0, 4, 0, 0); cons.gridx = 0; // JLabel dummyLabel = new JLabel(" "); // cons.gridy++; // portPanel.add(dummyLabel, cons); cons.gridy++; portPanel.add(resetCheckbox, cons); cons.insets = new Insets(0, 30, 0, 0); cons.gridx = 0; cons.gridy++; portPanel.add(noMultiResetbox, cons); JCheckBox fullTextCheckAtFirstBox = new JCheckBox( Tools.getLabel(messages.getString("guiCheckFullTextAtFirst"))); fullTextCheckAtFirstBox.setSelected(config.doFullCheckAtFirst()); fullTextCheckAtFirstBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { config.setFullCheckAtFirst(fullTextCheckAtFirstBox.isSelected()); } }); cons.insets = new Insets(0, 4, 0, 0); cons.gridx = 0; // cons.gridy++; // JLabel dummyLabel2 = new JLabel(" "); // portPanel.add(dummyLabel2, cons); cons.gridy++; portPanel.add(fullTextCheckAtFirstBox, cons); JCheckBox isMultiThreadBox = new JCheckBox(Tools.getLabel(messages.getString("guiIsMultiThread"))); isMultiThreadBox.setSelected(config.isMultiThread()); isMultiThreadBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { config.setMultiThreadLO(isMultiThreadBox.isSelected()); } }); cons.gridy++; JLabel dummyLabel3 = new JLabel(" "); portPanel.add(dummyLabel3, cons); cons.gridy++; portPanel.add(isMultiThreadBox, cons); }
From source file:org.languagetool.gui.Main.java
private void createGUI() { loadRecentFiles();//w w w . j a va 2 s.c om frame = new JFrame("LanguageTool " + JLanguageTool.VERSION); setLookAndFeel(); openAction = new OpenAction(); saveAction = new SaveAction(); saveAsAction = new SaveAsAction(); checkAction = new CheckAction(); autoCheckAction = new AutoCheckAction(true); showResultAction = new ShowResultAction(true); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); frame.addWindowListener(new CloseListener()); URL iconUrl = JLanguageTool.getDataBroker().getFromResourceDirAsUrl(TRAY_ICON); frame.setIconImage(new ImageIcon(iconUrl).getImage()); textArea = new JTextArea(); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); textArea.addKeyListener(new ControlReturnTextCheckingListener()); textLineNumber = new TextLineNumber(textArea, 2); numberedTextAreaPane = new JScrollPane(textArea); numberedTextAreaPane.setRowHeaderView(textLineNumber); resultArea = new JTextPane(); undoRedo = new UndoRedoSupport(this.textArea, messages); frame.setJMenuBar(createMenuBar()); GridBagConstraints buttonCons = new GridBagConstraints(); JPanel insidePanel = new JPanel(); insidePanel.setOpaque(false); insidePanel.setLayout(new GridBagLayout()); buttonCons.gridx = 0; buttonCons.gridy = 0; buttonCons.anchor = GridBagConstraints.LINE_START; insidePanel.add(new JLabel(messages.getString("textLanguage") + " "), buttonCons); //create a ComboBox with flags, do not include hidden languages languageBox = LanguageComboBox.create(messages, EXTERNAL_LANGUAGE_SUFFIX, true, false); buttonCons.gridx = 1; buttonCons.gridy = 0; buttonCons.anchor = GridBagConstraints.LINE_START; insidePanel.add(languageBox, buttonCons); JCheckBox autoDetectBox = new JCheckBox(messages.getString("atd")); buttonCons.gridx = 2; buttonCons.gridy = 0; buttonCons.gridwidth = GridBagConstraints.REMAINDER; buttonCons.anchor = GridBagConstraints.LINE_START; insidePanel.add(autoDetectBox, buttonCons); buttonCons.gridx = 0; buttonCons.gridy = 1; buttonCons.gridwidth = GridBagConstraints.REMAINDER; buttonCons.fill = GridBagConstraints.HORIZONTAL; buttonCons.anchor = GridBagConstraints.LINE_END; buttonCons.weightx = 1.0; insidePanel.add(statusLabel, buttonCons); Container contentPane = frame.getContentPane(); GridBagLayout gridLayout = new GridBagLayout(); contentPane.setLayout(gridLayout); GridBagConstraints cons = new GridBagConstraints(); cons.gridx = 0; cons.gridy = 1; cons.fill = GridBagConstraints.HORIZONTAL; cons.anchor = GridBagConstraints.FIRST_LINE_START; JToolBar toolbar = new JToolBar("Toolbar", JToolBar.HORIZONTAL); toolbar.setFloatable(false); contentPane.add(toolbar, cons); JButton openButton = new JButton(openAction); openButton.setHideActionText(true); openButton.setFocusable(false); toolbar.add(openButton); JButton saveButton = new JButton(saveAction); saveButton.setHideActionText(true); saveButton.setFocusable(false); toolbar.add(saveButton); JButton saveAsButton = new JButton(saveAsAction); saveAsButton.setHideActionText(true); saveAsButton.setFocusable(false); toolbar.add(saveAsButton); JButton spellButton = new JButton(this.checkAction); spellButton.setHideActionText(true); spellButton.setFocusable(false); toolbar.add(spellButton); JToggleButton autoSpellButton = new JToggleButton(autoCheckAction); autoSpellButton.setHideActionText(true); autoSpellButton.setFocusable(false); toolbar.add(autoSpellButton); JButton clearTextButton = new JButton(new ClearTextAction()); clearTextButton.setHideActionText(true); clearTextButton.setFocusable(false); toolbar.add(clearTextButton); cons.insets = new Insets(5, 5, 5, 5); cons.fill = GridBagConstraints.BOTH; cons.weightx = 10.0f; cons.weighty = 10.0f; cons.gridx = 0; cons.gridy = 2; cons.weighty = 5.0f; splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, numberedTextAreaPane, new JScrollPane(resultArea)); mainPanel.setLayout(new GridLayout(0, 1)); contentPane.add(mainPanel, cons); mainPanel.add(splitPane); cons.fill = GridBagConstraints.HORIZONTAL; cons.gridx = 0; cons.gridy = 3; cons.weightx = 1.0f; cons.weighty = 0.0f; cons.insets = new Insets(4, 12, 4, 12); contentPane.add(insidePanel, cons); ltSupport = new LanguageToolSupport(this.frame, this.textArea, this.undoRedo); ResultAreaHelper.install(messages, ltSupport, resultArea); languageBox.selectLanguage(ltSupport.getLanguage()); languageBox.setEnabled(!ltSupport.getConfig().getAutoDetect()); autoDetectBox.setSelected(ltSupport.getConfig().getAutoDetect()); taggerShowsDisambigLog = ltSupport.getConfig().getTaggerShowsDisambigLog(); languageBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { // we cannot re-use the existing LT object anymore frame.applyComponentOrientation(ComponentOrientation.getOrientation(Locale.getDefault())); Language lang = languageBox.getSelectedLanguage(); ComponentOrientation componentOrientation = ComponentOrientation .getOrientation(lang.getLocale()); textArea.applyComponentOrientation(componentOrientation); resultArea.applyComponentOrientation(componentOrientation); ltSupport.setLanguage(lang); } } }); autoDetectBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { boolean selected = e.getStateChange() == ItemEvent.SELECTED; languageBox.setEnabled(!selected); ltSupport.getConfig().setAutoDetect(selected); if (selected) { Language detected = ltSupport.autoDetectLanguage(textArea.getText()); languageBox.selectLanguage(detected); } } }); ltSupport.addLanguageToolListener(new LanguageToolListener() { @Override public void languageToolEventOccurred(LanguageToolEvent event) { if (event.getType() == LanguageToolEvent.Type.CHECKING_STARTED) { String msg = org.languagetool.tools.Tools.i18n(messages, "checkStart"); statusLabel.setText(msg); if (event.getCaller() == getFrame()) { setWaitCursor(); checkAction.setEnabled(false); } } else if (event.getType() == LanguageToolEvent.Type.CHECKING_FINISHED) { if (event.getCaller() == getFrame()) { checkAction.setEnabled(true); unsetWaitCursor(); } String msg = org.languagetool.tools.Tools.i18n(messages, "checkDone", event.getSource().getMatches().size(), event.getElapsedTime()); statusLabel.setText(msg); } else if (event.getType() == LanguageToolEvent.Type.LANGUAGE_CHANGED) { languageBox.selectLanguage(ltSupport.getLanguage()); } else if (event.getType() == LanguageToolEvent.Type.RULE_ENABLED) { //this will trigger a check and the result will be updated by //the CHECKING_FINISHED event } else if (event.getType() == LanguageToolEvent.Type.RULE_DISABLED) { String msg = org.languagetool.tools.Tools.i18n(messages, "checkDoneNoTime", event.getSource().getMatches().size()); statusLabel.setText(msg); } } }); frame.applyComponentOrientation(ComponentOrientation.getOrientation(Locale.getDefault())); Language lang = ltSupport.getLanguage(); ComponentOrientation componentOrientation = ComponentOrientation.getOrientation(lang.getLocale()); textArea.applyComponentOrientation(componentOrientation); resultArea.applyComponentOrientation(componentOrientation); ResourceBundle textLanguageMessageBundle = JLanguageTool.getMessageBundle(ltSupport.getLanguage()); textArea.setText(textLanguageMessageBundle.getString("guiDemoText")); Configuration config = ltSupport.getConfig(); if (config.getFontName() != null || config.getFontStyle() != Configuration.FONT_STYLE_INVALID || config.getFontSize() != Configuration.FONT_SIZE_INVALID) { String fontName = config.getFontName(); if (fontName == null) { fontName = textArea.getFont().getFamily(); } int fontSize = config.getFontSize(); if (fontSize == Configuration.FONT_SIZE_INVALID) { fontSize = textArea.getFont().getSize(); } Font font = new Font(fontName, config.getFontStyle(), fontSize); textArea.setFont(font); } frame.pack(); frame.setSize(WINDOW_WIDTH, WINDOW_HEIGHT); frame.setLocationByPlatform(true); splitPane.setDividerLocation(200); MainWindowStateBean state = localStorage.loadProperty("gui.state", MainWindowStateBean.class); if (state != null) { if (state.getBounds() != null) { frame.setBounds(state.getBounds()); ResizeComponentListener.setBoundsProperty(frame, state.getBounds()); } if (state.getDividerLocation() != null) { splitPane.setDividerLocation(state.getDividerLocation()); } if (state.getState() != null) { frame.setExtendedState(state.getState()); } } ResizeComponentListener.attachToWindow(frame); maybeStartServer(); }
From source file:org.languagetool.gui.Main.java
private void tagTextAndDisplayResults() { JLanguageTool langTool = ltSupport.getLanguageTool(); // tag text/*from ww w . ja va 2s . c o m*/ List<String> sentences = langTool.sentenceTokenize(textArea.getText()); StringBuilder sb = new StringBuilder(); if (taggerShowsDisambigLog) { sb.append("<table>"); sb.append("<tr>"); sb.append("<td><b>"); sb.append(messages.getString("token")); sb.append("</b></td>"); sb.append("<td><b>"); sb.append(messages.getString("disambiguatorLog")); sb.append("</b></td>"); sb.append("</tr>"); boolean odd = true; try { for (String sent : sentences) { AnalyzedSentence analyzed = langTool.getAnalyzedSentence(sent); odd = appendTagsWithDisambigLog(sb, analyzed, odd); } } catch (Exception e) { sb.append(getStackTraceAsHtml(e)); } sb.append("</table>"); } else { try { for (String sent : sentences) { AnalyzedSentence analyzed = langTool.getAnalyzedSentence(sent); String analyzedString = StringTools.escapeHTML(analyzed.toString(",")) .replace("<S>", "<S><br>").replace("[", "<font color='" + TAG_COLOR + "'>[") .replace("]", "]</font><br>"); sb.append(analyzedString).append('\n'); } } catch (Exception e) { sb.append(getStackTraceAsHtml(e)); } } SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if (taggerDialog == null) { taggerDialog = new JDialog(frame); taggerDialog.setTitle(messages.getString("taggerWindowTitle")); taggerDialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); taggerDialog.setResizable(true); taggerDialog.setSize(640, 480); taggerDialog.setLocationRelativeTo(frame); KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); ActionListener actionListener = actionEvent -> taggerDialog.setVisible(false); taggerDialog.getRootPane().registerKeyboardAction(actionListener, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW); JPanel panel = new JPanel(new GridBagLayout()); taggerDialog.add(panel); taggerArea = new JTextPane(); taggerArea.setContentType("text/html"); taggerArea.setEditable(false); GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridwidth = 2; c.gridy = 0; c.weightx = 1.0; c.weighty = 1.0; c.insets = new Insets(8, 8, 4, 8); c.fill = GridBagConstraints.BOTH; panel.add(new JScrollPane(taggerArea), c); c.gridwidth = 1; c.gridx = 0; c.gridy = 1; c.weightx = 0.0; c.weighty = 0.0; c.insets = new Insets(4, 8, 8, 8); c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.EAST; JCheckBox showDisAmbig = new JCheckBox(messages.getString("ShowDisambiguatorLog")); showDisAmbig.setSelected(taggerShowsDisambigLog); showDisAmbig.addItemListener((ItemEvent e) -> { taggerShowsDisambigLog = e.getStateChange() == ItemEvent.SELECTED; ltSupport.getConfig().setTaggerShowsDisambigLog(taggerShowsDisambigLog); }); panel.add(showDisAmbig, c); c.gridx = 1; JButton closeButton = new JButton(messages.getString("guiCloseButton")); closeButton.addActionListener(actionListener); panel.add(closeButton, c); } // orientation each time should be set as language may is changed taggerDialog.applyComponentOrientation( ComponentOrientation.getOrientation(languageBox.getSelectedLanguage().getLocale())); taggerDialog.setVisible(true); taggerArea.setText(HTML_FONT_START + sb + HTML_FONT_END); } }); }