List of usage examples for javax.swing GroupLayout createSequentialGroup
public SequentialGroup createSequentialGroup()
From source file:org.xapagy.ui.tempdyn.GraphEvolution.java
/** * This function generates a frame into which a number of graphs are * arranged horizontally. Each graph describes the time series values for a * given in-focus object. We have: the focus (with all the energy colors - * salience / energy), the memory (with all the energy colors - salience / * energy), and a list of shadows (with all the energy colors - salience / * energy).//w ww. j ava 2s . c o m * * @param tdc * @param database * @param agent * @param index * - the index of time values * @param isInstance * - true for instances * @param shadowComponents * - how many components will we enter in the graph * @param shadowRange * - the range of the y plot on the shadows - needs to be unique. * * */ public static void graphFMSComposite(tdComponent tdc, tdDataBase database, Agent agent, List<Double> index, int shadowComponents, double shadowRange, GraphEvolutionDescriptor ged) { String label = tdc.getLastPrettyPrint(); // FIXME: this is a tiny bit iffy: we are getting the shadows based on a // certain energy color String ecx = EnergyColors.SHI_GENERIC; List<String> shadowList = database.getShadowComponents(tdc.getIdentifier(), ecx, shadowComponents); // // ok, now let us create a graph // JPanel panel = new JPanel(); // create a layout GroupLayout layout = new GroupLayout(panel); panel.setLayout(layout); layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); SequentialGroup sgv = layout.createSequentialGroup(); layout.setVerticalGroup(sgv); ParallelGroup pgh = layout.createParallelGroup(); layout.setHorizontalGroup(pgh); // // the graph with the focus values // if (ged.graphFocusEnergy || ged.graphFocusSalience) { JFreeChart chart = chartFocusEvolution(tdc, label, database, agent, index, ged); ChartPanel cp = new ChartPanel(chart); sgv.addComponent(cp); pgh.addComponent(cp); } // // the graph with the memory values // if (ged.graphMemoryEnergy || ged.graphMemorySalience) { JFreeChart chart = chartMemoryEvolution(tdc, label, database, agent, index, ged); ChartPanel cp = new ChartPanel(chart); sgv.addComponent(cp); pgh.addComponent(cp); } // // the graphs with the shadow components // if (ged.graphShadowEnergy || ged.graphShadowSalience) { for (String sh : shadowList) { JFreeChart chart = chartShadowEvolution(tdc, sh, database, agent, index, shadowRange, ged); ChartPanel cp = new ChartPanel(chart); sgv.addComponent(cp); pgh.addComponent(cp); } } JFrame frame = new JFrame(); frame.add(panel); frame.pack(); frame.setVisible(true); }
From source file:org.xapagy.ui.tempdyn.GraphEvolution.java
/** * Graphs which plots the evolution of all the links from a given VI. If the * linkType is not null, it filters based on that, otherwise, it plots all * the link types/* w w w. ja va2s .c om*/ * * @param fromVi * @param linkType * @param tdb * @param agent * @param index */ public static void graphLinksFromAVi(tdComponent fromVi, String linkType, tdDataBase tdb, Agent agent, List<Double> index) { String label; if (linkType != null) { label = "Links of type " + linkType + " from " + fromVi.getIdentifier(); } else { label = "Links of all types from " + fromVi.getIdentifier(); } // create a general purpose xy collection for jfreechart XYSeriesCollection xysc = new XYSeriesCollection(); List<tdComponent> linkedVis = tdb.getFocusVis(); List<String> types = new ArrayList<>(); if (linkType != null) { types.add(linkType); } else { types.addAll(agent.getLinks().getLinkTypeNames()); } // add a series for each VI - if not null for (tdComponent toVi : linkedVis) { for (String linkName : types) { boolean addDecision = false; String id; if (linkType != null) { id = toVi.getIdentifier() + "-" + toVi.getLastPrettyPrint(); } else { id = linkName + " to " + toVi.getIdentifier() + "-" + toVi.getLastPrettyPrint(); } XYSeries linkSeries = new XYSeries(id); // now fill in the series with values for (Double time : index) { double dtime = time; double linkValue = tdb.getLinkValue(fromVi.getIdentifier(), toVi.getIdentifier(), linkName, time); if (linkValue != 0.0) { addDecision = true; } linkSeries.add(dtime, linkValue); } if (addDecision) { xysc.addSeries(linkSeries); } } } // // ok, now let us create a graph // JPanel panel = new JPanel(); // create a layout GroupLayout layout = new GroupLayout(panel); panel.setLayout(layout); layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); SequentialGroup sgv = layout.createSequentialGroup(); layout.setVerticalGroup(sgv); ParallelGroup pgh = layout.createParallelGroup(); layout.setHorizontalGroup(pgh); JFreeChart chart = ChartFactory.createXYLineChart(label, "Time", "Value", xysc, PlotOrientation.VERTICAL, true, false, false); GraphEvolution.setChartProperties(chart, GraphEvolution.lineStylesColorful); ChartPanel cp = new ChartPanel(chart); sgv.addComponent(cp); pgh.addComponent(cp); JFrame frame = new JFrame(); frame.add(panel); frame.pack(); frame.setVisible(true); }
From source file:net.chunkyhosting.Roe.computer.CHGManager.gui.panels.ServerDisplay.java
public ServerDisplay(JSONObject server) { JLabel game = new JLabel(server.getString("gametype")); JLabel statusImg = new JLabel( new ImageIcon(CHGManager.getInstance().getSettings().getWorkingDirectory().toString() + File.separator + "img" + File.separator + "icons" + File.separator + "ball_green.gif")); JLabel statusDetail = new JLabel("284/500"); JLabel ip = new JLabel(server.getString("ip") + ":" + server.getString("port")); JButton console = new JButton( new ImageIcon(CHGManager.getInstance().getSettings().getWorkingDirectory().toString() + File.separator + "img" + File.separator + "icons" + File.separator + "console.gif")); JButton restart = new JButton( new ImageIcon(CHGManager.getInstance().getSettings().getWorkingDirectory().toString() + File.separator + "img" + File.separator + "icons" + File.separator + "restart.gif")); JButton stop = new JButton( new ImageIcon(CHGManager.getInstance().getSettings().getWorkingDirectory().toString() + File.separator + "img" + File.separator + "icons" + File.separator + "stop.gif")); JButton edit = new JButton( new ImageIcon(CHGManager.getInstance().getSettings().getWorkingDirectory().toString() + File.separator + "img" + File.separator + "icons" + File.separator + "edit.gif")); GroupLayout gl_panel = new GroupLayout(this); gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel.createSequentialGroup().addContainerGap().addComponent(game).addGap(18) .addComponent(statusImg).addGap(18).addComponent(statusDetail).addGap(18).addComponent(ip) .addPreferredGap(ComponentPlacement.RELATED, 178, Short.MAX_VALUE).addComponent(console) .addPreferredGap(ComponentPlacement.RELATED).addComponent(restart) .addPreferredGap(ComponentPlacement.RELATED).addComponent(stop) .addPreferredGap(ComponentPlacement.RELATED).addComponent(edit))); gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel.createSequentialGroup().addContainerGap() .addGroup(gl_panel.createParallelGroup(Alignment.BASELINE).addComponent(edit) .addComponent(stop).addComponent(restart).addComponent(console)) .addContainerGap(23, Short.MAX_VALUE)) .addGroup(Alignment.TRAILING, gl_panel.createSequentialGroup().addContainerGap(15, Short.MAX_VALUE) .addGroup(gl_panel.createParallelGroup(Alignment.BASELINE).addComponent(game) .addComponent(statusImg).addComponent(statusDetail).addComponent(ip)) .addGap(14))); this.setLayout(gl_panel); }
From source file:Main.java
private JPanel create() { JPanel panel = new JPanel(); GroupLayout layout = new GroupLayout(panel); panel.setLayout(layout);/*w ww . j a va2 s. c o m*/ layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); GroupLayout.ParallelGroup parallel = layout.createParallelGroup(); layout.setHorizontalGroup(layout.createSequentialGroup().addGroup(parallel)); GroupLayout.SequentialGroup sequential = layout.createSequentialGroup(); layout.setVerticalGroup(sequential); for (int i = 0; i < NUM; i++) { labels[i] = new JLabel(String.valueOf(i + 1), JLabel.RIGHT); fields[i] = new JTextField(String.valueOf("" + (i + 1))); labels[i].setLabelFor(fields[i]); parallel.addGroup(layout.createSequentialGroup().addComponent(labels[i]).addComponent(fields[i])); sequential.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(labels[i]) .addComponent(fields[i])); layout.linkSize(SwingConstants.HORIZONTAL, labels[i], labels[0]); } return panel; }
From source file:layout.Find.java
public Find() { JLabel label = new JLabel("Find What:"); ;//from ww w . j av a 2 s . c om JTextField textField = new JTextField(); JCheckBox caseCheckBox = new JCheckBox("Match Case"); JCheckBox wrapCheckBox = new JCheckBox("Wrap Around"); JCheckBox wholeCheckBox = new JCheckBox("Whole Words"); JCheckBox backCheckBox = new JCheckBox("Search Backwards"); JButton findButton = new JButton("Find"); JButton cancelButton = new JButton("Cancel"); // remove redundant default border of check boxes - they would hinder // correct spacing and aligning (maybe not needed on some look and feels) caseCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); wrapCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); wholeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); backCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(label) .addGroup(layout.createParallelGroup(LEADING).addComponent(textField) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(LEADING).addComponent(caseCheckBox) .addComponent(wholeCheckBox)) .addGroup(layout.createParallelGroup(LEADING).addComponent(wrapCheckBox) .addComponent(backCheckBox)))) .addGroup(layout.createParallelGroup(LEADING).addComponent(findButton).addComponent(cancelButton))); layout.linkSize(SwingConstants.HORIZONTAL, findButton, cancelButton); layout.setVerticalGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(BASELINE).addComponent(label).addComponent(textField) .addComponent(findButton)) .addGroup(layout.createParallelGroup(LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(BASELINE).addComponent(caseCheckBox) .addComponent(wrapCheckBox)) .addGroup(layout.createParallelGroup(BASELINE).addComponent(wholeCheckBox) .addComponent(backCheckBox))) .addComponent(cancelButton))); setTitle("Find"); pack(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); }
From source file:modmanager.swing.ImageListRenderer.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor.//from w ww . j a va2s .c o m */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { fileNameLabel = new javax.swing.JLabel(); imagePanel = new modmanager.swing.ImagePanel(); fileNameLabel.setText("jLabel1"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(imagePanel, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(fileNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 477, Short.MAX_VALUE))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(fileNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE) .addComponent(imagePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); }
From source file:lookandfeel.SynthDialog.java
public SynthDialog() { JLabel label = new JLabel("Find What:"); ;/* w w w. ja v a 2 s. c om*/ JTextField textField = new JTextField(); JCheckBox caseCheckBox = new JCheckBox("Match Case"); JCheckBox wrapCheckBox = new JCheckBox("Wrap Around"); JCheckBox wholeCheckBox = new JCheckBox("Whole Words"); JCheckBox backCheckBox = new JCheckBox("Search Backwards"); JButton findButton = new JButton("Find"); JButton cancelButton = new JButton("Cancel"); // remove redundant default border of check boxes - they would hinder // correct spacing and aligning (maybe not needed on some look and feels) caseCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); wrapCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); wholeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); backCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(label) .addGroup(layout.createParallelGroup(LEADING).addComponent(textField) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(LEADING).addComponent(caseCheckBox) .addComponent(wholeCheckBox)) .addGroup(layout.createParallelGroup(LEADING).addComponent(wrapCheckBox) .addComponent(backCheckBox)))) .addGroup(layout.createParallelGroup(LEADING).addComponent(findButton).addComponent(cancelButton))); layout.linkSize(SwingConstants.HORIZONTAL, findButton, cancelButton); layout.setVerticalGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(BASELINE).addComponent(label).addComponent(textField) .addComponent(findButton)) .addGroup(layout.createParallelGroup(LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(BASELINE).addComponent(caseCheckBox) .addComponent(wrapCheckBox)) .addGroup(layout.createParallelGroup(BASELINE).addComponent(wholeCheckBox) .addComponent(backCheckBox))) .addComponent(cancelButton))); setTitle("Find"); pack(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); }
From source file:br.com.lnprojetos.springbootswing.ui.PessoaUI.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor.//from w ww. j av a 2 s . c o m */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jButton1 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE); jButton1.setText("jButton1"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGap(50, 50, 50).addComponent(jButton1) .addContainerGap(278, Short.MAX_VALUE))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jButton1) .addContainerGap(259, Short.MAX_VALUE))); pack(); }
From source file:com.actian.services.knime.core.operators.DeriveGroupNodeDialogPane.java
private void initComponents() { this.expression = new JTextArea(10, 20); expression.setWrapStyleWord(true);// ww w . j av a2s. co m expression.setFont(new Font("Monospaced", Font.PLAIN, 11)); this.expressionPanel = new JScrollPane(expression); this.expressionPanel.setBorder(BorderFactory.createTitledBorder("Group Expressions")); functionPanel = new JPanel(); functionPanel.setLayout(new GridLayout(0, 1, 0, 0)); functionPanel.setBorder(BorderFactory.createTitledBorder("Available Aggregate Functions")); fcomboBox = new JComboBox(); fcomboBox.setMaximumRowCount(10); fcomboBox.setModel(new DefaultComboBoxModel(new String[] { "Function - Description" })); fcomboBox.setFont(new Font("Monospaced", Font.PLAIN, 10)); functionPanel.add(fcomboBox); GroupLayout groupLayout = new GroupLayout(this); groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.TRAILING).addGroup(groupLayout .createSequentialGroup() .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addGroup(Alignment.LEADING, groupLayout.createSequentialGroup().addContainerGap().addComponent(columnSelect, GroupLayout.DEFAULT_SIZE, 433, Short.MAX_VALUE)) .addGroup(Alignment.LEADING, groupLayout.createSequentialGroup().addGap(7).addComponent(expressionPanel, GroupLayout.DEFAULT_SIZE, 436, Short.MAX_VALUE)) .addGroup(Alignment.LEADING, groupLayout.createSequentialGroup().addContainerGap() .addComponent(functionPanel, GroupLayout.DEFAULT_SIZE, 433, Short.MAX_VALUE))) .addGap(7))); groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup().addGap(5) .addComponent(expressionPanel, GroupLayout.DEFAULT_SIZE, 203, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(functionPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(columnSelect, GroupLayout.PREFERRED_SIZE, 248, GroupLayout.PREFERRED_SIZE) .addContainerGap())); setLayout(groupLayout); }
From source file:UserInterface.JFreeChart.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor.//from ww w . ja v a2 s. c o m */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanel1.setLayout(new java.awt.BorderLayout()); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(390, Short.MAX_VALUE))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGap(26, 26, 26) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(274, Short.MAX_VALUE))); pack(); }