List of usage examples for java.awt GridLayout setVgap
public void setVgap(int vgap)
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 w ww .jav a 2s.c om 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);/*from ww w . java2 s .co 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 {/*ww w . ja va 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) { 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 {/* w w w . j av a 2 s .c o m*/ 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 . ja v a2 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("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:com.anji.floatingeye.FloatingEyeDisplay.java
private void init(Java2DSurface surface, FloatingEye anEye) { eye = anEye;/*from w w w . ja v a 2 s. co 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_Wykresy.PanelRysunek_Wykres.java
private void initGUI() { try {//from ww w . j av a 2s. 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) { 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:syg_package01.PanelRysunek.java
private void initGUI() { try {/* w ww.j a v a 2 s. 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) { 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:gtu._work.ui.ObnfInsertCreaterUI.java
private void initGUI() { try {//from www.j av a 2s .co m JCommonUtil.defaultToolTipDelay(); BorderLayout thisLayout = new BorderLayout(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); getContentPane().setLayout(thisLayout); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { jPanel1 = new JPanel(); jTabbedPane1.addTab("?schema", null, jPanel1, null); { jLabel1 = new JLabel(); jPanel1.add(jLabel1); jLabel1.setText("tableName"); } { tableNameText = new JTextField(); jPanel1.add(tableNameText); tableNameText.setPreferredSize(new java.awt.Dimension(155, 22)); } { useDomainJarDefineChkBox = new JCheckBox(); jPanel1.add(useDomainJarDefineChkBox); useDomainJarDefineChkBox.setText("\u4ee5dominJar\u70ba\u6e96"); } { dominJarFileText = new JTextField(); File currentFile = new File(PropertiesUtil.getJarCurrentPath(getClass()), "sris-db-domain-2.5.0-SRIS-SNAPSHOT.jar"); if (currentFile.exists()) { dominJarFileText.setText(currentFile.getAbsolutePath()); } else { File cUserFile = new File("C:\\Users"); if (cUserFile.exists()) { String domainJarPath = "C:/Users/%s/.m2/repository/tw/gov/sris-db-domain/2.5.0-SRIS-SNAPSHOT/sris-db-domain-2.5.0-SRIS-SNAPSHOT.jar"; for (File f : cUserFile.listFiles()) { File jf = new File(String.format(domainJarPath, f.getName())); if (jf.exists()) { dominJarFileText.setText(jf.getAbsolutePath()); break; } } } } jPanel1.add(dominJarFileText); dominJarFileText.setPreferredSize(new java.awt.Dimension(219, 22)); JCommonUtil.jTextFieldSetFilePathMouseEvent(dominJarFileText, false); } { jLabel5 = new JLabel(); jPanel1.add(jLabel5); jLabel5.setText("obnfString"); jLabel5.setPreferredSize(new java.awt.Dimension(83, 15)); } { jScrollPane2 = new JScrollPane(); jPanel1.add(jScrollPane2); jScrollPane2.setPreferredSize(new java.awt.Dimension(544, 76)); { obnfArea = new JTextArea(); jScrollPane2.setViewportView(obnfArea); } } { jLabel6 = new JLabel(); jPanel1.add(jLabel6); jLabel6.setText("sql"); jLabel6.setPreferredSize(new java.awt.Dimension(58, 15)); } { jScrollPane3 = new JScrollPane(); jPanel1.add(jScrollPane3); jScrollPane3.setPreferredSize(new java.awt.Dimension(543, 116)); { insertSqlArea = new JTextArea(); jScrollPane3.setViewportView(insertSqlArea); } } { executeBtn = new JButton(); jPanel1.add(executeBtn); executeBtn.setText("\u8b80\u53d6ObnfString"); executeBtn.setPreferredSize(new java.awt.Dimension(146, 29)); executeBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { executeBtnAction(); } }); } { processSqlBtn = new JButton(); jPanel1.add(processSqlBtn); processSqlBtn.setText("\u7522\u751fSQL"); processSqlBtn.setPreferredSize(new java.awt.Dimension(135, 29)); processSqlBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { processSqlBtnAction(); } }); } } { jPanel2 = new JPanel(); BorderLayout jPanel2Layout = new BorderLayout(); jPanel2.setLayout(jPanel2Layout); jTabbedPane1.addTab("?", null, jPanel2, null); { jPanel3 = new JPanel(); jPanel2.add(jPanel3, BorderLayout.NORTH); jPanel3.setPreferredSize(new java.awt.Dimension(585, 61)); { jLabel4 = new JLabel(); jPanel3.add(jLabel4); jLabel4.setText("dbField"); } { dbFieldText = new JTextField(); jPanel3.add(dbFieldText); dbFieldText.setPreferredSize(new java.awt.Dimension(216, 22)); } { jLabel3 = new JLabel(); jPanel3.add(jLabel3); jLabel3.setText("value"); } { dbValue = new JTextField(); jPanel3.add(dbValue); dbValue.setPreferredSize(new java.awt.Dimension(244, 22)); } { pkCheckBox = new JCheckBox(); jPanel3.add(pkCheckBox); pkCheckBox.setText("\u662fPK"); } { addFieldBtn = new JButton(); jPanel3.add(addFieldBtn); addFieldBtn.setText("saveOrUpdate"); addFieldBtn.setPreferredSize(new java.awt.Dimension(116, 22)); addFieldBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { addFieldBtnAction(); } }); } { deleteFieldBtn = new JButton(); jPanel3.add(deleteFieldBtn); deleteFieldBtn.setText("delete"); deleteFieldBtn.setPreferredSize(new java.awt.Dimension(88, 22)); deleteFieldBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { deleteFieldBtnAction(); } }); } } { jScrollPane1 = new JScrollPane(); jPanel2.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(585, 258)); { DefaultListModel dbFieldListModel = new DefaultListModel(); dbFieldList = new JList(); jScrollPane1.setViewportView(dbFieldList); dbFieldList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { dbFieldListMousePreformd(evt); } }); dbFieldList.setModel(dbFieldListModel); dbFieldList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { JListUtil.newInstance(dbFieldList).defaultJListKeyPressed(evt); } }); } } } { jPanel4 = new JPanel(); GridLayout jPanel4Layout = new GridLayout(1, 1); jPanel4Layout.setColumns(1); jPanel4Layout.setHgap(5); jPanel4Layout.setVgap(5); jPanel4.setLayout(jPanel4Layout); jTabbedPane1.addTab("?", null, jPanel4, null); { manualDefineArea = new JTextArea(); jPanel4.add(manualDefineArea); manualDefineArea.setText(""); manualDefineArea.setToolTipText("?"); } { manualDefinePkArea = new JTextArea(); jPanel4.add(manualDefinePkArea); manualDefinePkArea.setText(""); manualDefinePkArea.setToolTipText("PK?"); } { manualDefineDbFieldBtn = new JButton(); jPanel4.add(manualDefineDbFieldBtn); manualDefineDbFieldBtn .setText("\u4ee5\u8cbc\u5165\u6b04\u4f4d\u5b9a\u7fa9\u6c7a\u5b9a\u6b04\u4f4d"); manualDefineDbFieldBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { manualDefineDbFieldBtnAction(); } }); } } } pack(); this.setSize(598, 366); } catch (Exception e) { //add your error handling code here e.printStackTrace(); } }
From source file:ar.edu.uns.cs.vyglab.arq.rockar.gui.JFrameControlPanel.java
private void initGUI() { try {//from w w w . j a v a2 s. com setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setIconImage(new ImageIcon(getClass().getClassLoader() .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/splash/purple-monkey32.png")) .getImage()); this.setTitle("Rock.AR v2.0"); this.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent evt) { thisComponentResized(evt); } }); this.addWindowListener(new WindowAdapter() { public void windowClosed(WindowEvent evt) { thisWindowClosed(evt); } }); { jPanelSouth = new JPanel(); BorderLayout jPanelSouthLayout = new BorderLayout(); getContentPane().add(jPanelSouth, BorderLayout.SOUTH); jPanelSouth.setLayout(jPanelSouthLayout); { jLabelInformation = new JLabel(); jPanelSouth.add(jLabelInformation, BorderLayout.CENTER); jLabelInformation.setText(DataCenter.langResource.getString("control_information_label")); jLabelInformation.setOpaque(true); jLabelInformation.setBackground(new java.awt.Color(241, 191, 101)); } } { jPanelCenter = new JPanel(); GridLayout jPanelCenterLayout = new GridLayout(1, 1); jPanelCenterLayout.setHgap(5); jPanelCenterLayout.setVgap(5); jPanelCenterLayout.setColumns(1); getContentPane().add(jPanelCenter, BorderLayout.CENTER); jPanelCenter.setLayout(jPanelCenterLayout); { jPanelWest = new JPanel(); BorderLayout jPanelWestLayout = new BorderLayout(); jPanelCenter.add(jPanelWest); jPanelWest.setLayout(jPanelWestLayout); jPanelWest.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); { jToolBarMineralTable = new JToolBar(); jToolBarMineralTable.setLayout(new FlowLayout(FlowLayout.LEFT)); jPanelWest.add(jToolBarMineralTable, BorderLayout.NORTH); jToolBarMineralTable.setFloatable(false); jToolBarMineralTable.setFocusable(false); { jButtonNew = new JButton(); jToolBarMineralTable.add(jButtonNew); jButtonNew.setIcon(new ImageIcon(getClass().getClassLoader().getResource( "ar/edu/uns/cs/vyglab/arq/rockar/resources/images/Actions-tab-new-icon.png"))); jButtonNew.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButtonNewActionPerformed(evt); } }); } { jButtonOpen = new JButton(); jToolBarMineralTable.add(jButtonOpen); jButtonOpen.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/open.png"))); jButtonOpen.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButtonOpenActionPerformed(evt); } }); } { jButtonSave = new JButton(); jToolBarMineralTable.add(jButtonSave); jButtonSave.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/save.png"))); jButtonSave.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButtonSaveActionPerformed(evt); } }); } { jSeparator1 = new JSeparator(); jToolBarMineralTable.add(jSeparator1); jSeparator1.setOrientation(SwingConstants.VERTICAL); jSeparator1.setSize(5, 44); jSeparator1.setPreferredSize(new java.awt.Dimension(5, 44)); } { jButtonAdd = new JButton(); jToolBarMineralTable.add(jButtonAdd); jButtonAdd.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/add.png"))); jButtonAdd.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButtonAddActionPerformed(evt); } }); } { jButtonEdit = new JButton(); jToolBarMineralTable.add(jButtonEdit); jButtonEdit.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/modify.png"))); jButtonEdit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButtonEditActionPerformed(evt); } }); } { jButtonRemove = new JButton(); jToolBarMineralTable.add(jButtonRemove); jButtonRemove.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/remove.png"))); jButtonRemove.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButtonRemoveActionPerformed(evt); } }); } } { jLabelMineralTableInformation = new JLabel(); jPanelWest.add(jLabelMineralTableInformation, BorderLayout.SOUTH); jLabelMineralTableInformation .setText(DataCenter.langResource.getString("total_counted_table")); jLabelMineralTableInformation.setHorizontalAlignment(SwingConstants.LEFT); jLabelMineralTableInformation.setBackground(new java.awt.Color(255, 212, 133)); jLabelMineralTableInformation.setOpaque(true); } { jScrollPaneMineralTable = new JScrollPane(); jPanelWest.add(jScrollPaneMineralTable, BorderLayout.CENTER); { jTableMineralsModel = new RockTableModel( new String[] { DataCenter.langResource.getString("keyvalue_table"), DataCenter.langResource.getString("name_table"), DataCenter.langResource.getString("color_table"), DataCenter.langResource.getString("counted_table"), DataCenter.langResource.getString("area_table") }, 0); // jTableMineralsModel.addRow(new Object[] { // 0, "x?", Color.gray, 0, // "0.00" }); jTableMinerals = new JReadOnlyTable(); jScrollPaneMineralTable.setViewportView(jTableMinerals); jTableMinerals.setModel(jTableMineralsModel); jTableMinerals.setDefaultRenderer(Color.class, new ColorRenderer(true)); TableCellRenderer centerRenderer = new CenterRenderer(); TableColumn column = jTableMinerals.getColumnModel().getColumn(0); column.setCellRenderer(centerRenderer); column = jTableMinerals.getColumnModel().getColumn(1); column.setCellRenderer(centerRenderer); column = jTableMinerals.getColumnModel().getColumn(3); column.setCellRenderer(centerRenderer); column = jTableMinerals.getColumnModel().getColumn(4); column.setCellRenderer(centerRenderer); } } } { jPanelEast = new JPanel(); jPanelCenter.add(jPanelEast); GridLayout jPanelEastLayout = new GridLayout(2, 1); jPanelEastLayout.setHgap(5); jPanelEastLayout.setVgap(5); jPanelEastLayout.setColumns(1); jPanelEast.setLayout(jPanelEastLayout); { jPanelTop = new JPanel(); BorderLayout jPanelTopLayout = new BorderLayout(); jPanelEast.add(jPanelTop); jPanelTop.setLayout(jPanelTopLayout); jPanelTop.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); { jToolBarStats = new JToolBar(); jPanelTop.add(jToolBarStats, BorderLayout.NORTH); jToolBarStats.setFloatable(false); jToolBarStats.setFocusable(false); { jButtonExportStats = new JButton(); jButtonExportStats.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { saveChartAsImage(); } }); //jToolBarStats.add(jButtonExportStats); jButtonExportStats.setIcon(new ImageIcon(getClass().getClassLoader().getResource( "ar/edu/uns/cs/vyglab/arq/rockar/resources/images/export-graph.png"))); } { jButtonExportExcel = new JButton(); //jToolBarStats.add(jButtonExportExcel); //jToolBarMineralTable.add(jButtonExportExcel); jButtonExportExcel.setIcon(new ImageIcon(getClass().getClassLoader().getResource( "ar/edu/uns/cs/vyglab/arq/rockar/resources/images/excel-icon.png"))); jButtonExportExcel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { exportToExcel(); } }); } { jButtonExportAll = new JButton(); //jToolBarStats.add(jButtonExportAll); jButtonExportAll.setIcon(new ImageIcon(getClass().getClassLoader().getResource( "ar/edu/uns/cs/vyglab/arq/rockar/resources/images/Mimetypes-application-vnd-ms-excel-icon.png"))); } } { } } { jPanelBottom = new JPanel(); BorderLayout jPanelBottomLayout = new BorderLayout(); jPanelEast.add(jPanelBottom); jPanelBottom.setLayout(jPanelBottomLayout); jPanelBottom.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); { jToolBarOverview = new JToolBar(); jPanelBottom.add(jToolBarOverview, BorderLayout.NORTH); jToolBarOverview.setFloatable(false); jToolBarOverview.setFocusable(false); { jButtonExportOverview = new JButton(); jToolBarOverview.add(jButtonExportOverview); jButtonExportOverview.setIcon(new ImageIcon(getClass().getClassLoader().getResource( "ar/edu/uns/cs/vyglab/arq/rockar/resources/images/export-graph.png"))); jButtonExportOverview.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { exportOverview(); } }); } } { jPanelOverviewContent = new JPanel(); jPanelBottom.add(jPanelOverviewContent, BorderLayout.CENTER); jPanelOverviewContent.setLayout(new GridBagLayout()); this.jLabelOverview = new JLabel(); jPanelOverviewContent.add(this.jLabelOverview); } } } } pack(); this.setSize(800, 600); } catch (Exception e) { //add your error handling code here e.printStackTrace(); } }