List of usage examples for javax.swing JFrame setLayout
public void setLayout(LayoutManager manager)
LayoutManager
. From source file:EHRAppointment.ChartPanelDraw.java
/** * * @param result// w w w . j av a 2 s. c o m * @param type */ public ChartPanelDraw(java.util.List<Vitals> result, String type) { this.type = type; this.result = result; dataset = createTimeDataset(); chartPanel = createChart(dataset, type); JFrame f = new JFrame("Vital Plot"); //Jframe to draw the graph f.setTitle("Vital Plot"); f.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); f.setLayout(new BorderLayout(0, 5)); f.add(chartPanel, BorderLayout.CENTER); f.setIconImage(new ImageIcon(getClass().getResource("/images/icon_transparent.png")).getImage()); chartPanel.setHorizontalAxisTrace(true); //set properties of the graph chartPanel.setVerticalAxisTrace(true); chartPanel.setMouseWheelEnabled(true); JPanel panel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); panel.add(createTrace()); //Add components to panel panel.add(createDate()); panel.add(createZoom()); f.add(panel, BorderLayout.SOUTH); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); }
From source file:support.TradingVolumeGui.java
private CategoryPlot createChartFrame(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart("Trading Volume", "Stock", "Volume, USD", dataset, PlotOrientation.HORIZONTAL, true, true, false); CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinePaint(Color.DARK_GRAY); plot.setRangeGridlinePaint(Color.DARK_GRAY); plot.getRenderer().setSeriesPaint(0, Color.BLUE); JFrame frame = new JFrame(); frame.setBackground(Color.WHITE); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.setTitle("Hazelcast Jet Source Builder Sample"); frame.setBounds(WINDOW_X, WINDOW_Y, WINDOW_WIDTH, WINDOW_HEIGHT); frame.setLayout(new BorderLayout()); frame.add(new ChartPanel(chart)); frame.setVisible(true);/*from w w w . j av a 2 s .c o m*/ frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent windowEvent) { hzMap.removeEntryListener(entryListenerId); } }); return plot; }
From source file:support.SystemMonitorGui.java
private XYPlot createChartFrame(XYSeries series) { XYSeriesCollection dataSet = new XYSeriesCollection(); dataSet.addSeries(series);//from w w w .j a va 2 s . c o m JFreeChart chart = ChartFactory.createXYLineChart("Memory Allocation Rate", "Time (ms)", "Allocation Rate (MB/s)", dataSet, PlotOrientation.VERTICAL, true, true, false); XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinePaint(Color.DARK_GRAY); plot.setRangeGridlinePaint(Color.DARK_GRAY); plot.getRenderer().setSeriesPaint(0, Color.BLUE); JFrame frame = new JFrame(); frame.setBackground(Color.WHITE); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.setTitle("Hazelcast Jet Source Builder Sample"); frame.setBounds(WINDOW_X, WINDOW_Y, WINDOW_WIDTH, WINDOW_HEIGHT); frame.setLayout(new BorderLayout()); frame.add(new ChartPanel(chart)); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent windowEvent) { hzMap.removeEntryListener(entryListenerId); } }); frame.setVisible(true); return plot; }
From source file:UserInterface.FarmerRole.MyDashboardFarmer.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed String csvFile = "C:/Users/user/Desktop/FinalProject/src/UserInterface/FarmerRole/HumidityFarmer.csv"; BufferedReader br = null;/*from www . j a v a 2s.c o m*/ String line = ""; String cvsSplitBy = ","; try { br = new BufferedReader(new FileReader(csvFile)); while ((line = br.readLine()) != null) { // use comma as separator String[] country = line.split(cvsSplitBy); HumiditySensor hs = userAccount.getInventory().getHumiditySensorDirectory() .addHumidity(Double.parseDouble(country[0]), country[1]); } JFrame f = new JFrame("Inventory Humidity"); //f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLayout(new GridLayout(1, 0)); for (HumiditySensor t : userAccount.getInventory().getHumiditySensorDirectory() .getHumiditySensorList()) { f.add(new HumidityGraph(t.getCurrentHumidity(), t.getType())); } f.pack(); f.setVisible(true); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } //HumidityGraph hg = new HumidityGraph(20); }
From source file:UserInterface.FarmerRole.MyDashboardFarmer.java
private void tempBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tempBtnActionPerformed String csvFile = "C:/Users/user/Desktop/FinalProject/src/UserInterface/FarmerRole/TemperatureFarmer.csv"; BufferedReader br = null;// w w w . j a va2s. c o m String line = ""; String cvsSplitBy = ","; try { br = new BufferedReader(new FileReader(csvFile)); while ((line = br.readLine()) != null) { // use comma as separator String[] country = line.split(cvsSplitBy); TemperatureSensor ts = userAccount.getInventory().getTemperatureSensorDirectory() .addTemp(Double.parseDouble(country[0]), country[1]); } //loop map JFrame f = new JFrame("Inventory Temperature"); //f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLayout(new GridLayout(1, 0)); for (TemperatureSensor t : userAccount.getInventory().getTemperatureSensorDirectory() .getTempSensorList()) { f.add(new ThermometerDemo(t.getCurrentTemperature(), t.getPerishability())); } f.pack(); f.setVisible(true); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } }
From source file:vteaexploration.plottools.panels.XYChartPanel.java
public void process(int x, int y, int l, String xText, String yText, String lText) { chartPanel = createChart(x, y, l, xText, yText, lText, imageGateOutline); JFrame f = new JFrame(title); f.setTitle(title);/*from w w w . j a v a2s . c o m*/ f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLayout(new BorderLayout(0, 5)); f.add(chartPanel, BorderLayout.CENTER); chartPanel.setOpaque(false); chartPanel.setMouseWheelEnabled(false); chartPanel.setDomainZoomable(false); chartPanel.setRangeZoomable(false); chartPanel.setPreferredSize(new Dimension(550, 485)); chartPanel.setBackground(new Color(0, 0, 0, 0)); chartPanel.revalidate(); chartPanel.repaint(); //chartPanel.set chartPanel.addChartMouseListener(new ChartMouseListener() { @Override public void chartMouseClicked(ChartMouseEvent cme) { chartPanel.getParent().repaint(); } @Override public void chartMouseMoved(ChartMouseEvent cme) { } }); chartPanel.addMouseMotionListener(new MouseMotionListener() { @Override public void mouseDragged(MouseEvent e) { chartPanel.getParent().repaint(); } @Override public void mouseMoved(MouseEvent e) { chartPanel.getParent().repaint(); } }); chartPanel.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mouseReleased(MouseEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mouseEntered(MouseEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mouseExited(MouseEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }); f.pack(); }
From source file:rod_design_compute.ShowPanel.java
private void chartRod() { DefaultXYDataset dataset1 = new DefaultXYDataset(); DefaultXYDataset dataset2 = new DefaultXYDataset(); DefaultXYDataset dataset3 = new DefaultXYDataset(); Rod indicator = null;//from w ww.j av a 2 s. c o m chooseRodGroup = parent.arrayRodGroup.get(chooseIndex); int amount; if (parent.upperLimit == -1) amount = parent.resolution; else amount = parent.upperLimit; double[][][] data = new double[3][2][amount]; for (int i = 0; i < amount; i++) { for (int j = 0; j < 3; j++) data[j][0][i] = i; if (chooseRodGroup.getType() == RodGroup.SR) { if (chooseRod == ((SR) (chooseRodGroup)).getL_dangan()) indicator = ((SR) (parent.arrayRecord.get(i).get(chooseIndex))).getL_dangan(); } else if (chooseRodGroup.getType() == RodGroup.RRR) { if (chooseRod == ((RRR) (chooseRodGroup)).getrodL2()) indicator = ((RRR) (parent.arrayRecord.get(i).get(chooseIndex))).getrodL2(); else if (chooseRod == ((RRR) (chooseRodGroup)).getrodL3()) indicator = ((RRR) (parent.arrayRecord.get(i).get(chooseIndex))).getrodL3(); } else if (chooseRodGroup.getType() == RodGroup.RRP) { if (chooseRod == ((RRP) (chooseRodGroup)).getrodL2()) indicator = ((RRP) (parent.arrayRecord.get(i).get(chooseIndex))).getrodL2(); } getRodData(data, indicator, i); } dataset1.addSeries("Angle", data[0]); dataset2.addSeries("AngleSpeed", data[1]); dataset3.addSeries("AngleAcceleration", data[2]); JFreeChart chart1 = ChartFactory.createXYLineChart("Angle", "angle()", "Angle(rad)", dataset1, PlotOrientation.VERTICAL, false, false, false); JFreeChart chart2 = ChartFactory.createXYLineChart("AngleSpeed", "angle()", "AngleSpeed", dataset2, PlotOrientation.VERTICAL, false, false, false); JFreeChart chart3 = ChartFactory.createXYLineChart("AngleAcceleration", "angle()", "AngleAcceleration", dataset3, PlotOrientation.VERTICAL, false, false, false); ChartPanel panel1 = new ChartPanel(chart1); ChartPanel panel2 = new ChartPanel(chart2); ChartPanel panel3 = new ChartPanel(chart3); JFrame frame = new JFrame("Chart"); frame.setLayout(new GridLayout(3, 1, 0, 0)); frame.add(panel1); frame.add(panel2); frame.add(panel3); frame.pack(); frame.setVisible(true); chooseRod = null; }
From source file:lospolloshermanos.SalesTablePan.java
private void jLabel14MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel14MouseClicked // TODO add your handling code here: BarChart demo = new BarChart("Categories", no_of_cats, categories); JFrame f = new JFrame(); f.setLayout(new GridLayout(1, 1)); f.add(demo);//from w ww . j av a 2 s . c o m f.setUndecorated(true); f.pack(); f.setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE); RefineryUtilities.centerFrameOnScreen(f); f.setVisible(true); }
From source file:rod_design_compute.ShowPanel.java
private void chartPoint() { DefaultXYDataset dataset1 = new DefaultXYDataset(); DefaultXYDataset dataset2 = new DefaultXYDataset(); DefaultXYDataset dataset3 = new DefaultXYDataset(); DefaultXYDataset dataset4 = new DefaultXYDataset(); DefaultXYDataset dataset5 = new DefaultXYDataset(); DefaultXYDataset dataset6 = new DefaultXYDataset(); DefaultXYDataset dataset7 = new DefaultXYDataset(); DefaultXYDataset dataset8 = new DefaultXYDataset(); Point indicator = null;// w w w . j a v a 2 s. c om chooseRodGroup = parent.arrayRodGroup.get(chooseIndex); int amount; if (parent.upperLimit == -1) amount = parent.resolution; else amount = parent.upperLimit; double[][][] data = new double[8][2][amount]; for (int i = 0; i < amount; i++) { for (int j = 0; j < 8; j++) data[j][0][i] = i; if (chooseRodGroup.getType() == RodGroup.SR) { if (choosePoint == ((SR) (chooseRodGroup)).getPointA()) indicator = ((SR) (parent.arrayRecord.get(i).get(chooseIndex))).getPointA(); else if (choosePoint == ((SR) (chooseRodGroup)).getPointB()) indicator = ((SR) (parent.arrayRecord.get(i).get(chooseIndex))).getPointB(); else if (((SR) (chooseRodGroup)).flag == true) { if (choosePoint == ((SR) (chooseRodGroup)).getPointE()) indicator = ((SR) (parent.arrayRecord.get(i).get(chooseIndex))).getPointE(); } } else if (chooseRodGroup.getType() == RodGroup.RRR) { if (choosePoint == ((RRR) (chooseRodGroup)).getPointB()) indicator = ((RRR) (parent.arrayRecord.get(i).get(chooseIndex))).getPointB(); else if (choosePoint == ((RRR) (chooseRodGroup)).getPointC()) indicator = ((RRR) (parent.arrayRecord.get(i).get(chooseIndex))).getPointC(); else if (choosePoint == ((RRR) (chooseRodGroup)).getPointD()) indicator = ((RRR) (parent.arrayRecord.get(i).get(chooseIndex))).getPointD(); else if (((RRR) (chooseRodGroup)).flag2 == true || ((RRR) (chooseRodGroup)).flag3 == true) { if (choosePoint == ((RRR) (chooseRodGroup)).getPointE()) indicator = ((RRR) (parent.arrayRecord.get(i).get(chooseIndex))).getPointE(); } } else if (chooseRodGroup.getType() == RodGroup.RRP) { if (choosePoint == ((RRP) (chooseRodGroup)).getPointB()) indicator = ((RRP) (parent.arrayRecord.get(i).get(chooseIndex))).getPointB(); else if (choosePoint == ((RRP) (chooseRodGroup)).getPointC()) indicator = ((RRP) (parent.arrayRecord.get(i).get(chooseIndex))).getPointC(); } getPointData(data, indicator, i); } dataset1.addSeries("Vx", data[0]); dataset2.addSeries("Vy", data[1]); dataset3.addSeries("V", data[2]); dataset4.addSeries("ax", data[3]); dataset5.addSeries("ay", data[4]); dataset6.addSeries("a", data[5]); dataset7.addSeries("X", data[6]); dataset8.addSeries("Y", data[7]); JFreeChart chart1 = ChartFactory.createXYLineChart("Vx", "angle()", "Vx", dataset1, PlotOrientation.VERTICAL, false, false, false); JFreeChart chart2 = ChartFactory.createXYLineChart("Vy", "angle()", "Vy", dataset2, PlotOrientation.VERTICAL, false, false, false); JFreeChart chart3 = ChartFactory.createXYLineChart("V", "angle()", "V", dataset3, PlotOrientation.VERTICAL, false, false, false); JFreeChart chart4 = ChartFactory.createXYLineChart("ax", "angle()", "ax", dataset4, PlotOrientation.VERTICAL, false, false, false); JFreeChart chart5 = ChartFactory.createXYLineChart("ay", "angle()", "ay", dataset5, PlotOrientation.VERTICAL, false, false, false); JFreeChart chart6 = ChartFactory.createXYLineChart("a", "angle()", "a", dataset6, PlotOrientation.VERTICAL, false, false, false); JFreeChart chart7 = ChartFactory.createXYLineChart("X", "angle()", "X", dataset7, PlotOrientation.VERTICAL, false, false, false); JFreeChart chart8 = ChartFactory.createXYLineChart("Y", "angle()", "Y", dataset8, PlotOrientation.VERTICAL, false, false, false); ChartPanel panel1 = new ChartPanel(chart1); ChartPanel panel2 = new ChartPanel(chart2); ChartPanel panel3 = new ChartPanel(chart3); ChartPanel panel4 = new ChartPanel(chart4); ChartPanel panel5 = new ChartPanel(chart5); ChartPanel panel6 = new ChartPanel(chart6); ChartPanel panel7 = new ChartPanel(chart7); ChartPanel panel8 = new ChartPanel(chart8); JFrame frame = new JFrame("Chart"); frame.setLayout(new GridLayout(3, 3, 0, 0)); frame.add(panel1); frame.add(panel2); frame.add(panel3); frame.add(panel4); frame.add(panel5); frame.add(panel6); frame.add(panel7); frame.add(panel8); frame.pack(); frame.setVisible(true); choosePoint = null; }
From source file:lospolloshermanos.SalesTablePan.java
private void jLabel16MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel16MouseClicked // TODO add your handling code here: JFrame f = new JFrame(); BarChart demo1 = new BarChart("Items", no_of_items, items); f.setLayout(new GridLayout(1, 1)); f.add(demo1);/* w ww .j av a 2s. co m*/ f.setUndecorated(true); f.pack(); f.setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE); RefineryUtilities.centerFrameOnScreen(f); f.setVisible(true); }