List of usage examples for javax.swing GroupLayout setHorizontalGroup
public void setHorizontalGroup(Group group)
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).//from w ww . j a v a 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/*from ww w . j av a 2s. 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:AppPackage.humidity.java
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout);//from w w w. jav a 2s.c o m layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 300, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 400, Short.MAX_VALUE)); pack(); }
From source file:pl.piotrsukiennik.jbrain.gui.SimulationHistoryPanel.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.// ww w .ja va2 s .c o m */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { simulationHistoryPane = new javax.swing.JTabbedPane(); setBackground(new java.awt.Color(255, 255, 255)); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(simulationHistoryPane, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(simulationHistoryPane, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)); }
From source file:inout.ChartFrame.java
public void initChart(JFreeChart chart) { ChartPanel chartPanel = new ChartPanel(chart); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout);//w w w.java 2 s. co m layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addComponent(chartPanel))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addComponent(chartPanel))); }
From source file:inout.ChartFrame.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 w w . jav a 2 s . co m */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 400, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 300, Short.MAX_VALUE)); pack(); }
From source file:com.jtk.pengelolaanujian.view.dashboard.PipePanelSample.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 w w. j av a2s. c o m*/ */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 323, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 252, Short.MAX_VALUE)); }
From source file:GUI_Internalframes.StatistikAnzeige.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 w w. j a v a2 s. c om */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { setClosable(true); setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE); setTitle("Statistik"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 740, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 408, Short.MAX_VALUE)); pack(); }
From source file:base64.string_manipulation.Test_Frame.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.//w w w . j ava 2s .c o m */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap() .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap() .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE) .addContainerGap())); pack(); }