List of usage examples for java.awt GridLayout setHgap
public void setHgap(int hgap)
From source file:Main.java
public Main() { JButton button = new JButton("w w w.j a v a 2 s . c o m"); add(button);/*from ww w . j a v a 2 s. c o m*/ add(new JButton("w w w.j a v a 2 s . com")); add(new JButton("w w w.java2s.com")); add(new JButton("www.j ava 2 s . c o m")); GridLayout gridLayout = new GridLayout(); gridLayout.setVgap(20); gridLayout.setHgap(30); setLayout(gridLayout); }
From source file:Main.java
public Main() { JButton button = new JButton("w w w.j a v a 2 s . c o m"); add(button);// www.java2 s . c o m add(new JButton("w w w.j a v a 2 s . com")); add(new JButton("w w w.java2s.com")); add(new JButton("www.j ava 2 s . c o m")); GridLayout gridLayout = new GridLayout(); gridLayout.setVgap(20); gridLayout.setHgap(30); setLayout(gridLayout); System.out.println(gridLayout.toString()); }
From source file:syg_package01.PanelRysunek2.java
private void initGUI() { try {//from w w w . ja v a2 s .c om GridLayout thisLayout = new GridLayout(1, 1); thisLayout.setHgap(5); thisLayout.setVgap(5); thisLayout.setColumns(1); this.setLayout(thisLayout); setPreferredSize(new Dimension(400, 300)); if (this.wykres) { double punkt = this.sygnalWyswietlany.gett1(); HistogramDataset histogramDataset = new HistogramDataset(); histogramDataset.setType(HistogramType.FREQUENCY); ArrayList<Double> punkty = new ArrayList<Double>(); double ta = this.sygnalWyswietlany.gett1(); if (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.CIAGLY || sygnalWyswietlany.getPunktyY().size() <= 0) { while (ta <= this.sygnalWyswietlany.gett1() + this.sygnalWyswietlany.getd()) { punkt = this.sygnalWyswietlany.wykres_punkty(punkt, ta); // this.sygnalWyswietlany.setPunktyY (punkt); punkty.add(punkt); ta = ta + this.sygnalWyswietlany.getkroczek(); } } else if (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.DYSKRETNY) { int iloscProbek = (int) (this.sygnalWyswietlany.getT() / (Double) this.sygnalWyswietlany.getkroczek()); for (int i = 0; i < iloscProbek; i++) { punkt = this.sygnalWyswietlany.getPunktzindexu(i); punkty.add(punkt); ta = ta + this.sygnalWyswietlany.getkroczek(); } } JFreeChart chartHist; if (this.iloscPrzedzialowHistogramu > 0) { double[] tablicaHistogramu = new double[punkty.size()]; for (int licznik = 0; licznik < punkty.size(); ++licznik) tablicaHistogramu[licznik] = punkty.get(licznik); histogramDataset.addSeries("Histogram (" + iloscPrzedzialowHistogramu + ")", tablicaHistogramu, this.iloscPrzedzialowHistogramu); chartHist = ChartFactory.createHistogram("Histogram", null, null, histogramDataset, PlotOrientation.VERTICAL, true, false, false); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, false); ChartPanel chartpanel1 = new ChartPanel(chartHist); chartpanel1.setDomainZoomable(true); this.add(chartpanel1); } } Application.getInstance().getContext().getResourceMap(getClass()).injectComponents(this); } catch (Exception e) { e.printStackTrace(); } }
From source file:gtu.xml.xstream.iisi.MQDecodeUI.java
private void initGUI() { try {//from w w w .j a v a 2 s. c om JCommonUtil.defaultLookAndFeel(); GridLayout thisLayout = new GridLayout(3, 1); thisLayout.setColumns(1); thisLayout.setHgap(5); thisLayout.setVgap(5); thisLayout.setRows(3); getContentPane().setLayout(thisLayout); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); { beforeArea = new JTextArea(); getContentPane().add(beforeArea); } { afterArea = new JTextArea(); getContentPane().add(afterArea); } { jPanel1 = new JPanel(); FlowLayout jPanel1Layout = new FlowLayout(); getContentPane().add(jPanel1); jPanel1.setPreferredSize(new java.awt.Dimension(546, 38)); jPanel1.setLayout(jPanel1Layout); { executeBtn = new JButton(); jPanel1.add(executeBtn); executeBtn.setText("\u7522\u751f"); executeBtn.setPreferredSize(new java.awt.Dimension(78, 22)); executeBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { Validate.notBlank(beforeArea.getText(), "messgaeContent"); String msg2 = beforeArea.getText(); XmlParserImpl xmlParserImpl = new XmlParserImpl(); final String jmsMessageXML = StringCompressUtil.uncompress(msg2); JmsMessageNew jmsMessageNew = (JmsMessageNew) xmlParserImpl .parseToObj(jmsMessageXML); String returnMessage = jmsMessageNew.getMessageXML(); System.out.println(returnMessage); afterArea.setText(returnMessage); System.out.println("done..."); } catch (Exception ex) { JCommonUtil.handleException(ex); } } }); } { cleanBtn = new JButton(); jPanel1.add(cleanBtn); cleanBtn.setText("\u6e05\u9664"); cleanBtn.setPreferredSize(new java.awt.Dimension(78, 22)); cleanBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { beforeArea.setText(""); afterArea.setText(""); } catch (Exception ex) { JCommonUtil.handleException(ex); } } }); } } pack(); this.setSize(554, 402); } catch (Exception e) { //add your error handling code here e.printStackTrace(); } }
From source file:syg_package01.PanelRysunek_Wykres.java
private void initGUI() { try {/*from w w w . j ava 2s .co m*/ GridLayout thisLayout = new GridLayout(1, 1); thisLayout.setHgap(5); thisLayout.setVgap(5); thisLayout.setColumns(1); this.setLayout(thisLayout); setPreferredSize(new Dimension(400, 300)); if (this.wykres) { XYSeries series = new XYSeries("Wykres"); double punkt; double ta = this.sygnalWyswietlany.gett1(); if (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.CIAGLY || sygnalWyswietlany.getPunktyY().size() <= 0) { punkt = this.sygnalWyswietlany.gett1(); while (ta <= this.sygnalWyswietlany.gett1() + this.sygnalWyswietlany.getd()) { punkt = this.sygnalWyswietlany.wykres_punkty(punkt, ta); this.sygnalWyswietlany.setPunktyY(punkt); series.add(ta, punkt); if (this.sygnalWyswietlany.gettyp() < 10) ta = ta + this.sygnalWyswietlany.getkroczek(); else ta = ta + this.sygnalWyswietlany.getkroczek() * 10; } } else if (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.DYSKRETNY && sygnalWyswietlany.getPunktyY().size() > 0) { punkt = sygnalWyswietlany.getPunktzindexu(0); int iloscProbek = (int) (this.sygnalWyswietlany.getPunktyY().size()); for (int i = 1; i < iloscProbek; i++) { punkt = this.sygnalWyswietlany.getPunktzindexu(i); series.add(ta, punkt); // if (this.sygnalWyswietlany.gettyp() < 10) // ta = ta + this.sygnalWyswietlany.getkroczek(); // else ta = ta + this.sygnalWyswietlany.getkroczek(); } } XYSeriesCollection dataset = new XYSeriesCollection(series); JFreeChart chart; if ((this.sygnalWyswietlany.gettyp() < 10) && (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.CIAGLY)) { chart = ChartFactory.createXYLineChart(null, null, null, dataset, PlotOrientation.VERTICAL, true, true, true); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, false); } else { chart = ChartFactory.createXYLineChart(null, null, null, dataset, PlotOrientation.VERTICAL, true, true, true); final XYPlot plot = chart.getXYPlot(); final XYDotRenderer renderer = new XYDotRenderer(); renderer.setDotHeight(3); renderer.setDotWidth(3); plot.setRenderer(renderer); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); } ChartPanel chartpanel = new ChartPanel(chart); chartpanel.setDomainZoomable(true); this.add(chartpanel); } Application.getInstance().getContext().getResourceMap(getClass()).injectComponents(this); } catch (Exception e) { e.printStackTrace(); } }
From source file:syg_Wykresy.PanelRysunek_Wykres.java
private void initGUI() { try {//from w w w.j ava 2 s . c o m GridLayout thisLayout = new GridLayout(1, 1); thisLayout.setHgap(5); thisLayout.setVgap(5); thisLayout.setColumns(1); this.setLayout(thisLayout); setPreferredSize(new Dimension(400, 300)); if (this.wykres) { XYSeries series = new XYSeries("Sygna " + (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.CIAGLY ? "cigy" : "dyskretny")); double punkt; double ta = this.sygnalWyswietlany.gett1(); if (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.CIAGLY || sygnalWyswietlany.getPunktyY_wykres().size() <= 0) { punkt = this.sygnalWyswietlany.gett1(); while (ta <= this.sygnalWyswietlany.gett1() + this.sygnalWyswietlany.getd()) { punkt = this.sygnalWyswietlany.wykres_punkty(punkt, ta); this.sygnalWyswietlany.setPunktyY_wykres(punkt); series.add(ta, punkt); if (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.CIAGLY) { if (this.sygnalWyswietlany.gettyp() != 9 && this.sygnalWyswietlany.gettyp() != 10) ta = ta + this.sygnalWyswietlany.getkroczek(); else ta = ta + this.sygnalWyswietlany.getkroczek() * 10; } else { if (this.sygnalWyswietlany.gettyp() != 9 && this.sygnalWyswietlany.gettyp() != 10) ta = ta + this.sygnalWyswietlany.getkrok(); else ta = ta + this.sygnalWyswietlany.getkrok() * 10; } } } else if (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.DYSKRETNY && sygnalWyswietlany.getPunktyY_wykres().size() > 0) { int iloscProbek = (int) (this.sygnalWyswietlany.getPunktyY_wykres().size()); for (int i = 0; i < iloscProbek; i++) { punkt = this.sygnalWyswietlany.getPunktzindexu(i); series.add(ta, punkt); ta = ta + this.sygnalWyswietlany.getkrok(); } } XYSeriesCollection dataset = new XYSeriesCollection(series); JFreeChart chart; if ((this.sygnalWyswietlany.gettyp() != 9 && this.sygnalWyswietlany.gettyp() != 10) && (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.CIAGLY)) { chart = ChartFactory.createXYLineChart(null, null, null, dataset, PlotOrientation.VERTICAL, true, true, true); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, false); } else { chart = ChartFactory.createXYLineChart(null, null, null, dataset, PlotOrientation.VERTICAL, true, true, true); final XYPlot plot = chart.getXYPlot(); final XYDotRenderer renderer = new XYDotRenderer(); renderer.setDotHeight(3); renderer.setDotWidth(3); plot.setRenderer(renderer); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); } // JOptionPane.showMessageDialog(null, "Rysowanie wykresu...", // "PanelRysunek_Wykres", JOptionPane.INFORMATION_MESSAGE); ChartPanel chartpanel = new ChartPanel(chart); chartpanel.setDomainZoomable(true); this.add(chartpanel); } Application.getInstance().getContext().getResourceMap(getClass()).injectComponents(this); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.anji.floatingeye.FloatingEyeDisplay.java
private void init(Java2DSurface surface, FloatingEye anEye) { eye = anEye;// w w w . java2 s. c o m // this frame has 3 sections - status, surface canvas, and eye canvas addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { setVisible(false); dispose(); } }); GridLayout mainLayout = new GridLayout(2, 1); mainLayout.setHgap(10); mainLayout.setVgap(10); getContentPane().setLayout(mainLayout); GridLayout topPanelLayout = new GridLayout(2, 1); topPanelLayout.setHgap(10); topPanelLayout.setVgap(10); Panel topPanel = new Panel(topPanelLayout); GridLayout bottomPanelLayout = new GridLayout(1, 2); bottomPanelLayout.setHgap(10); bottomPanelLayout.setVgap(10); Panel bottomPanel = new Panel(bottomPanelLayout); // 1 - status area statusArea = new TextArea("", 1, 1, TextArea.SCROLLBARS_VERTICAL_ONLY); statusArea.setEditable(false); statusArea.setFont(new Font("Dialog", Font.PLAIN, 10)); statusArea.setSize(new Dimension(IMG_WIDTH * 2, IMG_HEIGHT / 2)); // 2 - affinity history chart XYSeriesCollection seriesCollection = new XYSeriesCollection(affinitySeries); JFreeChart chart = ChartFactory.createXYLineChart("affinity history", "step", "affinity", seriesCollection, PlotOrientation.VERTICAL, false, false, false); ValueAxis rangeAxis = chart.getXYPlot().getRangeAxis(); rangeAxis.setAutoRange(false); rangeAxis.setRange(0d, 1d); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(IMG_WIDTH * 2, IMG_HEIGHT / 2)); // 3 - surface canvas surfaceCanvas = new SurfaceCanvas(surface, eye, IMG_WIDTH, IMG_HEIGHT); surfaceCanvas.setBackground(Color.WHITE); // 4 - eye canvas eyeCanvas = new EyeCanvas(eye, IMG_WIDTH, IMG_HEIGHT); eyeCanvas.setBackground(Color.WHITE); topPanel.add(statusArea); topPanel.add(chartPanel); bottomPanel.add(surfaceCanvas); bottomPanel.add(eyeCanvas); getContentPane().add(topPanel); getContentPane().add(bottomPanel); pack(); }
From source file:syg_package01.PanelRysunek.java
private void initGUI() { try {/*from w w w . ja va 2 s .com*/ GridLayout thisLayout = new GridLayout(1, 1); thisLayout.setHgap(5); thisLayout.setVgap(5); thisLayout.setColumns(1); this.setLayout(thisLayout); setPreferredSize(new Dimension(400, 300)); if (this.wykres) { double punkt = this.sygnalWyswietlany.gett1(); double punktZapisu = this.sygnalWyswietlany.gett1(); XYSeries series = new XYSeries("Wykres"); double krok; int typ = this.sygnalWyswietlany.gettyp(); double f = 1.0 / this.sygnalWyswietlany.getT(); double t = this.sygnalWyswietlany.gett1(); // if (this.sygnalWyswietlany.gettyp()==1){ /* * for (double i = this.sygnalWyswietlany.gett1(); i < * this.sygnalWyswietlany.t1+this.sygnalWyswietlany.getts(); * i++){ punkt= this.sygnalWyswietlany.wykres_punkty(punkt, i); * series.add(i, punkt)} ; */ double ta = this.sygnalWyswietlany.gett1(); if (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.CIAGLY || sygnalWyswietlany.getPunktyY().size() <= 0) { while (ta <= this.sygnalWyswietlany.gett1() + this.sygnalWyswietlany.getd()) { // punkt=this.sygnalWyswietlany.sygnalS1(); punkt = this.sygnalWyswietlany.wykres_punkty(punkt, ta); this.sygnalWyswietlany.setPunktyY(punkt); // punkt=this.sygnalWyswietlany.sygnalS3(ta); series.add(ta, punkt); if (this.sygnalWyswietlany.gettyp() < 10) ta = ta + this.sygnalWyswietlany.getkroczek(); else ta = ta + this.sygnalWyswietlany.getkroczek() * 10; } } else if (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.DYSKRETNY && sygnalWyswietlany.getPunktyY().size() > 0) { int iloscProbek = (int) (this.sygnalWyswietlany.getPunktyY().size()); for (int i = 0; i < iloscProbek; i++) { // punkt=this.sygnalWyswietlany.sygnalS1(); punkt = this.sygnalWyswietlany.getPunktzindexu(i); // punkt=this.sygnalWyswietlany.sygnalS3(ta); series.add(ta, punkt); if (this.sygnalWyswietlany.gettyp() < 10) ta = ta + this.sygnalWyswietlany.getkroczek(); else ta = ta + this.sygnalWyswietlany.getkroczek() * 10; } } // this.sygnalWyswietlany.ustawPunkty(); /* * int liczba= this.sygnalWyswietlany.punktyY.size(); int * liczba2= 0; * * while (liczba2<liczba) { ta= ta+ * this.sygnalWyswietlany.getkroczek(); * series.add(ta,this.sygnalWyswietlany * .getPunktzindexu(liczba2)); * * } */ XYSeriesCollection dataset = new XYSeriesCollection(series); // JFreeChart chart = ChartFactory.createHistogram("Histogram", // "x", "y", dataset, PlotOrientation.VERTICAL, false, false, // false); JFreeChart chart; /* * JFreeChart chart = ChartFactory.createScatterPlot("Wykres", * "t[s]", "Warto", dataset, PlotOrientation.VERTICAL, false, * false, false); */ if ((this.sygnalWyswietlany.gettyp() < 10) || (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.CIAGLY)) { chart = ChartFactory.createXYLineChart(null, null, null, dataset, PlotOrientation.VERTICAL, true, true, true); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, false); } else { chart = ChartFactory.createXYLineChart(null, null, null, dataset, PlotOrientation.VERTICAL, true, true, true); final XYPlot plot = chart.getXYPlot(); // plot.setBackgroundPaint(Color.lightGray); // plot.setDomainGridlinePaint(Color.white); // plot.setRangeGridlinePaint(Color.white); // final XYLineAndShapeRenderer renderer = new // XYLineAndShapeRenderer(); final XYDotRenderer renderer = new XYDotRenderer(); renderer.setDotHeight(3); renderer.setDotWidth(3); plot.setRenderer(renderer); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); } // ChartPanel chartpanel = new ChartPanel(wykres2); ChartPanel chartpanel = new ChartPanel(chart); chartpanel.setDomainZoomable(true); this.add(chartpanel); } Application.getInstance().getContext().getResourceMap(getClass()).injectComponents(this); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.codecrate.shard.ui.view.PlayerCharacterPanel.java
/** * This method initializes jPanel/*from w ww .j av a 2 s . c o m*/ * * @return javax.swing.JPanel */ private JPanel getBasicInfoPanel() { if (basicInfoPanel == null) { alignmentScript = new JLabel(); alignmentScript.setText("Alignment:"); alignmentScript.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); raceScript = new JLabel(); raceScript.setText("Race:"); raceScript.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); classScript = new JLabel(); classScript.setText("Class:"); classScript.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); levelScript = new JLabel(); levelScript.setText("Level:"); levelScript.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); GridLayout gridLayout = new GridLayout(); gridLayout.setRows(2); gridLayout.setHgap(5); basicInfoPanel = new JPanel(); basicInfoPanel.setLocation(new java.awt.Point(165, 44)); basicInfoPanel.setSize(new java.awt.Dimension(300, 60)); basicInfoPanel.setLayout(gridLayout); basicInfoPanel.add(classScript, null); basicInfoPanel.add(getClassValue(), null); basicInfoPanel.add(levelScript, null); basicInfoPanel.add(getLevelValue(), null); basicInfoPanel.add(raceScript, null); basicInfoPanel.add(getRaceValue(), null); basicInfoPanel.add(alignmentScript, null); basicInfoPanel.add(getAlignmentValue(), null); } return basicInfoPanel; }
From source file:org.apache.jmeter.visualizers.CreateReport.java
public JPanel createSavePanel() { saveAsCsv.setSelected(true);// w ww. j a v a2s.co m browse.setActionCommand(BROWSE); browse.addActionListener(this); // createErrorLog.setActionCommand(CEL); JPanel basepathPanel = new JPanel(); JPanel panel1 = new JPanel(new GridLayout(1, 3)); JPanel panel2 = new JPanel(); JPanel panel3 = new JPanel(new BorderLayout()); JPanel panel5 = new JPanel(new BorderLayout()); JPanel panel4 = new JPanel(new BorderLayout()); GridLayout grid = new GridLayout(1, 2); grid.setHgap(50); panel2.setLayout(grid); panel1.add(saveAsCsv); panel1.add(saveAsPdf); // panel1.add(save); panel2.add(viewTestHistory); panel2.add(compareTestReports); panel3.add(panel1, BorderLayout.NORTH); panel3.add(panel2, BorderLayout.SOUTH); panel5.add(selectDir, BorderLayout.WEST); panel5.add(basepath, BorderLayout.CENTER); panel5.add(browse, BorderLayout.EAST); viewTestHistory.addActionListener(this); viewTestHistory.setEnabled(true); compareTestReports.addActionListener(this); compareTestReports.setEnabled(true); panel4.add(panel5, BorderLayout.NORTH); panel4.add(panel3, BorderLayout.SOUTH); return panel4; }