List of usage examples for java.awt Color lightGray
Color lightGray
To view the source code for java.awt Color lightGray.
Click Source Link
From source file:com.seniorproject.augmentedreality.test.LineChartDemo6.java
/** * Creates a chart./*from w w w. jav a 2 s . co m*/ * * @param dataset the data for the chart. * * @return a chart. */ private JFreeChart createChart(final XYDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createXYLineChart("Line Chart Demo 6", // chart title "X", // x axis label "Y", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // final StandardLegend legend = (StandardLegend) chart.getLegend(); // legend.setDisplaySeriesShapes(true); // get a reference to the plot for further customisation... final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesShapesVisible(1, false); plot.setRenderer(renderer); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:eu.choreos.chart.XYChart.java
private JFreeChart createChart(XYDataset dataset, String chartTitle) { // create the chart... JFreeChart chart = ChartFactory.createXYLineChart(chartTitle, // chart title "Execution size", // domain axis label "Range", // range axis label dataset, // initial series PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? );/* w w w.j a va 2 s . c o m*/ // set chart background chart.setBackgroundPaint(Color.white); // set a few custom plot features XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(new Color(0xffffe0)); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); // set the plot's axes to display integers TickUnitSource ticks = NumberAxis.createIntegerTickUnits(); NumberAxis domain = (NumberAxis) plot.getDomainAxis(); domain.setStandardTickUnits(ticks); domain.resizeRange(1.1); domain.setLowerBound(0.5); NumberAxis range = (NumberAxis) plot.getRangeAxis(); range.setStandardTickUnits(ticks); range.setUpperBound(range.getUpperBound() * 1.1); // render shapes and lines XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, true); plot.setRenderer(renderer); renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); // set the renderer's stroke Stroke stroke = new BasicStroke(3f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL); renderer.setBaseOutlineStroke(stroke); // label the points NumberFormat format = NumberFormat.getNumberInstance(); format.setMaximumFractionDigits(2); XYItemLabelGenerator generator = new StandardXYItemLabelGenerator( StandardXYItemLabelGenerator.DEFAULT_ITEM_LABEL_FORMAT, format, format); renderer.setBaseItemLabelGenerator(generator); renderer.setBaseItemLabelsVisible(true); return chart; }
From source file:net.imglib2.script.analysis.BarChart.java
static private final void setBarTheme(final JFreeChart chart) { CategoryPlot plot = (CategoryPlot) chart.getPlot(); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setSeriesOutlinePaint(0, Color.lightGray); renderer.setShadowVisible(false);//from w w w. jav a2s .c o m renderer.setDrawBarOutline(true); setBackgroundDefault(chart); }
From source file:RowHeaderTable.java
public RowHeaderTable() { super("Row Header Test"); setSize(300, 200);//from ww w .j av a 2s . c o m setDefaultCloseOperation(EXIT_ON_CLOSE); TableModel tm = new AbstractTableModel() { String data[] = { "", "a", "b", "c", "d", "e" }; String headers[] = { "Row #", "Column 1", "Column 2", "Column 3", "Column 4", "Column 5" }; public int getColumnCount() { return data.length; } public int getRowCount() { return 1000; } public String getColumnName(int col) { return headers[col]; } // Synthesize some entries using the data values & the row # public Object getValueAt(int row, int col) { return data[col] + row; } }; // Create a column model for the main table. This model ignores the // first // column added, and sets a minimum width of 150 pixels for all others. TableColumnModel cm = new DefaultTableColumnModel() { boolean first = true; public void addColumn(TableColumn tc) { // Drop the first column . . . that'll be the row header if (first) { first = false; return; } tc.setMinWidth(150); // just for looks, really... super.addColumn(tc); } }; // Create a column model that will serve as our row header table. This // model picks a maximum width and only stores the first column. TableColumnModel rowHeaderModel = new DefaultTableColumnModel() { boolean first = true; public void addColumn(TableColumn tc) { if (first) { tc.setMaxWidth(tc.getPreferredWidth()); super.addColumn(tc); first = false; } // Drop the rest of the columns . . . this is the header column // only } }; JTable jt = new JTable(tm, cm); // Set up the header column and get it hooked up to everything JTable headerColumn = new JTable(tm, rowHeaderModel); jt.createDefaultColumnsFromModel(); headerColumn.createDefaultColumnsFromModel(); // Make sure that selections between the main table and the header stay // in sync (by sharing the same model) jt.setSelectionModel(headerColumn.getSelectionModel()); // Make the header column look pretty //headerColumn.setBorder(BorderFactory.createEtchedBorder()); headerColumn.setBackground(Color.lightGray); headerColumn.setColumnSelectionAllowed(false); headerColumn.setCellSelectionEnabled(false); // Put it in a viewport that we can control a bit JViewport jv = new JViewport(); jv.setView(headerColumn); jv.setPreferredSize(headerColumn.getMaximumSize()); // With out shutting off autoResizeMode, our tables won't scroll // correctly (horizontally, anyway) jt.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); // We have to manually attach the row headers, but after that, the // scroll // pane keeps them in sync JScrollPane jsp = new JScrollPane(jt); jsp.setRowHeader(jv); jsp.setCorner(ScrollPaneConstants.UPPER_LEFT_CORNER, headerColumn.getTableHeader()); getContentPane().add(jsp, BorderLayout.CENTER); }
From source file:net.pickapack.chart.LinePlotFrame.java
/** * Create a line plot frame.//from w w w .ja v a 2 s .c om * * @param linePlot the line plot * @param width the width * @param height the height */ public LinePlotFrame(LinePlot linePlot, int width, int height) { super(linePlot.getTitle()); this.linePlot = linePlot; this.numSubPlots = linePlot.getSubLinePlots().size(); CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("Time")); this.dataSets = new ArrayList<TimeSeriesCollection>(); this.dataSinks = new ArrayList<Map<SubLinePlotLine, Function<Double>>>(); for (SubLinePlot subLinePlot : linePlot.getSubLinePlots()) { TimeSeriesCollection dataSetsPerSubPlot = new TimeSeriesCollection(); this.dataSets.add(dataSetsPerSubPlot); HashMap<SubLinePlotLine, Function<Double>> dataSinksPerSubPlot = new HashMap<SubLinePlotLine, Function<Double>>(); this.dataSinks.add(dataSinksPerSubPlot); for (SubLinePlotLine subLinePlotLine : subLinePlot.getLines()) { TimeSeries timeSeries = new TimeSeries(subLinePlotLine.getTitle()); dataSetsPerSubPlot.addSeries(timeSeries); dataSinksPerSubPlot.put(subLinePlotLine, subLinePlotLine.getGetValueCallback()); } NumberAxis rangeAxis = new NumberAxis(subLinePlot.getTitleY()); rangeAxis.setAutoRangeIncludesZero(false); XYPlot subplot = new XYPlot(dataSetsPerSubPlot, null, rangeAxis, new StandardXYItemRenderer()); subplot.setBackgroundPaint(Color.lightGray); subplot.setDomainGridlinePaint(Color.white); subplot.setRangeGridlinePaint(Color.white); plot.add(subplot); } JFreeChart chart = new JFreeChart(linePlot.getTitle(), plot); chart.setBorderPaint(Color.black); chart.setBorderVisible(true); chart.setBackgroundPaint(Color.white); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); axis.setFixedAutoRange(3600000.0); JPanel content = new JPanel(new BorderLayout()); ChartPanel chartPanel = new ChartPanel(chart); content.add(chartPanel); chartPanel.setPreferredSize(new java.awt.Dimension(width, height)); chartPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); setContentPane(content); DataSink dataSink = new DataSink(); new Thread(dataSink).start(); }
From source file:de.fhffm.jad.demo.view.LineChartPanel.java
/** * Creates a sample chart./*w w w . j ava2 s . c om*/ * * @param dataset a dataset. * * @return The chart. */ private JFreeChart createChart(final XYDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createXYLineChart("Realtime Anomaly Detection", // chart title "Time", // x axis label "Percent", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); plot.setRenderer(renderer); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:srvclientmonitor.frmMain.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. j av a 2 s. c o m */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { pnlMain = new javax.swing.JPanel(); pnlMonMain = new javax.swing.JPanel(); pnlStatMon = new javax.swing.JPanel(); lblMon = new javax.swing.JLabel(); lblTime = new javax.swing.JLabel(); lblTimeValue0 = new javax.swing.JLabel(); pnlStatMon1 = new javax.swing.JPanel(); lblMon1 = new javax.swing.JLabel(); lblTime1 = new javax.swing.JLabel(); lblTimeValue1 = new javax.swing.JLabel(); pnlStatMon2 = new javax.swing.JPanel(); lblMon2 = new javax.swing.JLabel(); lblActive1 = new javax.swing.JLabel(); lblTimeNow2 = new javax.swing.JLabel(); lblTime2 = new javax.swing.JLabel(); lblTimeValue2 = new javax.swing.JLabel(); pnlStatMon3 = new javax.swing.JPanel(); lblMon3 = new javax.swing.JLabel(); lblActive2 = new javax.swing.JLabel(); lblTimeNow3 = new javax.swing.JLabel(); lblTime3 = new javax.swing.JLabel(); lblTimeValue3 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jPanel1 = new javax.swing.JPanel(); jButton2 = new javax.swing.JButton(); jToolBar1 = new javax.swing.JToolBar(); lblTimeNow = new javax.swing.JLabel(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenuItem1 = new javax.swing.JMenuItem(); jMenuItem2 = new javax.swing.JMenuItem(); jMenu4 = new javax.swing.JMenu(); jMenu3 = new javax.swing.JMenu(); jMenu2 = new javax.swing.JMenu(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setBackground(java.awt.Color.lightGray); pnlMain.setFont(new java.awt.Font("Dialog", 0, 10)); // NOI18N pnlMonMain.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(51, 51, 51))); pnlStatMon.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(51, 51, 51), 1, true)); lblMon.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N lblMon.setForeground(new java.awt.Color(255, 255, 255)); lblMon.setText("Monitor"); lblTime.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N lblTime.setForeground(new java.awt.Color(255, 255, 255)); lblTime.setText("Time:"); lblTimeValue0.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N lblTimeValue0.setForeground(new java.awt.Color(255, 255, 255)); lblTimeValue0.setText(" "); lblTimeValue0.setToolTipText(""); javax.swing.GroupLayout pnlStatMonLayout = new javax.swing.GroupLayout(pnlStatMon); pnlStatMon.setLayout(pnlStatMonLayout); pnlStatMonLayout.setHorizontalGroup(pnlStatMonLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlStatMonLayout.createSequentialGroup().addContainerGap().addGroup(pnlStatMonLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlStatMonLayout.createSequentialGroup().addComponent(lblMon).addGap(0, 0, Short.MAX_VALUE)) .addGroup(pnlStatMonLayout.createSequentialGroup().addComponent(lblTime) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent( lblTimeValue0, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE))) .addContainerGap())); pnlStatMonLayout.setVerticalGroup(pnlStatMonLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlStatMonLayout.createSequentialGroup().addContainerGap().addComponent(lblMon) .addGap(25, 25, 25) .addGroup(pnlStatMonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblTimeValue0).addComponent(lblTime)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); pnlStatMon1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(51, 51, 51), 1, true)); lblMon1.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N lblMon1.setForeground(new java.awt.Color(255, 255, 255)); lblMon1.setText("Metadata"); lblTime1.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N lblTime1.setForeground(new java.awt.Color(255, 255, 255)); lblTime1.setText("Time:"); lblTimeValue1.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N lblTimeValue1.setForeground(new java.awt.Color(255, 255, 255)); lblTimeValue1.setText(" "); lblTimeValue1.setToolTipText(""); javax.swing.GroupLayout pnlStatMon1Layout = new javax.swing.GroupLayout(pnlStatMon1); pnlStatMon1.setLayout(pnlStatMon1Layout); pnlStatMon1Layout.setHorizontalGroup(pnlStatMon1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlStatMon1Layout.createSequentialGroup().addContainerGap() .addGroup(pnlStatMon1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlStatMon1Layout.createSequentialGroup().addComponent(lblMon1) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(pnlStatMon1Layout.createSequentialGroup().addComponent(lblTime1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblTimeValue1, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE) .addContainerGap())))); pnlStatMon1Layout.setVerticalGroup(pnlStatMon1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlStatMon1Layout.createSequentialGroup().addContainerGap().addComponent(lblMon1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(pnlStatMon1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblTime1).addComponent(lblTimeValue1)) .addContainerGap())); pnlStatMon2.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(51, 51, 51), 1, true)); lblMon2.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N lblMon2.setForeground(new java.awt.Color(255, 255, 255)); lblMon2.setText("Services"); lblActive1.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N lblActive1.setForeground(new java.awt.Color(255, 255, 255)); lblActive1.setText("Actives:"); lblTimeNow2.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N lblTimeNow2.setForeground(new java.awt.Color(255, 255, 255)); lblTimeNow2.setText("0"); lblTimeNow2.setToolTipText(""); lblTime2.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N lblTime2.setForeground(new java.awt.Color(255, 255, 255)); lblTime2.setText("Time:"); lblTimeValue2.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N lblTimeValue2.setForeground(new java.awt.Color(255, 255, 255)); lblTimeValue2.setText(" "); lblTimeValue2.setToolTipText(""); javax.swing.GroupLayout pnlStatMon2Layout = new javax.swing.GroupLayout(pnlStatMon2); pnlStatMon2.setLayout(pnlStatMon2Layout); pnlStatMon2Layout.setHorizontalGroup(pnlStatMon2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlStatMon2Layout.createSequentialGroup().addContainerGap() .addGroup(pnlStatMon2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblMon2) .addGroup(pnlStatMon2Layout.createSequentialGroup().addComponent(lblActive1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblTimeNow2, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(pnlStatMon2Layout.createSequentialGroup().addComponent(lblTime2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblTimeValue2))) .addContainerGap())); pnlStatMon2Layout.setVerticalGroup(pnlStatMon2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlStatMon2Layout.createSequentialGroup().addContainerGap().addComponent(lblMon2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(pnlStatMon2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblActive1).addComponent(lblTimeNow2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(pnlStatMon2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblTime2).addComponent(lblTimeValue2)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); pnlStatMon3.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(51, 51, 51), 1, true)); lblMon3.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N lblMon3.setForeground(new java.awt.Color(255, 255, 255)); lblMon3.setText("Process"); lblActive2.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N lblActive2.setForeground(new java.awt.Color(255, 255, 255)); lblActive2.setText("Actives:"); lblTimeNow3.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N lblTimeNow3.setForeground(new java.awt.Color(255, 255, 255)); lblTimeNow3.setText("0"); lblTimeNow3.setToolTipText(""); lblTime3.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N lblTime3.setForeground(new java.awt.Color(255, 255, 255)); lblTime3.setText("Time:"); lblTimeValue3.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N lblTimeValue3.setForeground(new java.awt.Color(255, 255, 255)); lblTimeValue3.setText(" "); lblTimeValue3.setToolTipText(""); javax.swing.GroupLayout pnlStatMon3Layout = new javax.swing.GroupLayout(pnlStatMon3); pnlStatMon3.setLayout(pnlStatMon3Layout); pnlStatMon3Layout.setHorizontalGroup(pnlStatMon3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlStatMon3Layout.createSequentialGroup().addContainerGap() .addGroup(pnlStatMon3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblMon3) .addGroup(pnlStatMon3Layout.createSequentialGroup().addComponent(lblActive2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblTimeNow3, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(pnlStatMon3Layout.createSequentialGroup().addComponent(lblTime3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblTimeValue3))) .addContainerGap())); pnlStatMon3Layout.setVerticalGroup(pnlStatMon3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlStatMon3Layout.createSequentialGroup().addContainerGap().addComponent(lblMon3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(pnlStatMon3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblActive2).addComponent(lblTimeNow3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(pnlStatMon3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblTime3).addComponent(lblTimeValue3)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); javax.swing.GroupLayout pnlMonMainLayout = new javax.swing.GroupLayout(pnlMonMain); pnlMonMain.setLayout(pnlMonMainLayout); pnlMonMainLayout.setHorizontalGroup(pnlMonMainLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlMonMainLayout.createSequentialGroup().addContainerGap() .addComponent(pnlStatMon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(pnlStatMon1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(pnlStatMon2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(pnlStatMon3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); pnlMonMainLayout.setVerticalGroup(pnlMonMainLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlMonMainLayout.createSequentialGroup().addContainerGap().addGroup(pnlMonMainLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(pnlStatMon3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(pnlStatMon2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(pnlMonMainLayout.createSequentialGroup() .addGroup(pnlMonMainLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(pnlStatMon1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(pnlStatMon, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap())); jButton1.setText("jButton1"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 387, Short.MAX_VALUE)); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 110, Short.MAX_VALUE)); jButton2.setText("jButton2"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); javax.swing.GroupLayout pnlMainLayout = new javax.swing.GroupLayout(pnlMain); pnlMain.setLayout(pnlMainLayout); pnlMainLayout.setHorizontalGroup(pnlMainLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlMainLayout.createSequentialGroup().addGap(43, 43, 43).addComponent(jButton1) .addGap(56, 56, 56) .addComponent( jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(218, Short.MAX_VALUE)) .addGroup(pnlMainLayout.createSequentialGroup().addContainerGap() .addComponent(pnlMonMain, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton2).addGap(119, 119, 119))); pnlMainLayout.setVerticalGroup(pnlMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlMainLayout.createSequentialGroup().addGroup(pnlMainLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlMainLayout.createSequentialGroup().addContainerGap().addComponent(pnlMonMain, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(pnlMainLayout.createSequentialGroup().addGap(41, 41, 41).addComponent(jButton2))) .addGroup(pnlMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlMainLayout.createSequentialGroup().addGap(80, 80, 80) .addComponent(jButton1)) .addGroup(pnlMainLayout.createSequentialGroup().addGap(38, 38, 38).addComponent( jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(78, Short.MAX_VALUE))); jToolBar1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(102, 102, 102), 1, true)); jToolBar1.setFloatable(false); jToolBar1.setRollover(true); jToolBar1.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N lblTimeNow.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N lblTimeNow.setForeground(new java.awt.Color(255, 255, 255)); lblTimeNow.setText(" "); jToolBar1.add(lblTimeNow); jMenu1.setText("General"); jMenu1.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N jMenuItem1.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/16x16_Login Manager.png"))); // NOI18N jMenuItem1.setText("Login"); jMenuItem1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem1ActionPerformed(evt); } }); jMenu1.add(jMenuItem1); jMenuItem2.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/16x16_Log Out.png"))); // NOI18N jMenuItem2.setText("Exit"); jMenuItem2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem2ActionPerformed(evt); } }); jMenu1.add(jMenuItem2); jMenuBar1.add(jMenu1); jMenu4.setText("Schedule"); jMenu4.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N jMenuBar1.add(jMenu4); jMenu3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/16x16_report_01.png"))); // NOI18N jMenu3.setText("Report"); jMenu3.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N jMenuBar1.add(jMenu3); jMenu2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/16x16_info_01.png"))); // NOI18N jMenu2.setText("About"); jMenu2.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N jMenuBar1.add(jMenu2); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(pnlMain, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(0, 14, Short.MAX_VALUE)) .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(pnlMain, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE))); pack(); }
From source file:de.openedu.serialconnect.lib.XYPlotter.java
/** * Creates a chart and a plotpanel and add it to the mainwindow. *//*from ww w. j a va 2s .com*/ private void createChart() { getContentPane().removeAll(); xyDataset = createDataset(""); // create the chart... chart = ChartFactory.createXYLineChart("", // chart title "Line Chart Demo 6" "x", // x axis label "f(x)", // y axis label xyDataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); renderer.setSeriesShapesVisible(0, false); // a thin line will be painted for series1 renderer.setSeriesLinesVisible(1, false); // points will be painted for series2 plot.setRenderer(renderer); // change the auto tick unit selection to integer units only... rangeAxis = (NumberAxis) plot.getRangeAxis(); domainAxis = (NumberAxis) plot.getDomainAxis(); // rangeAxis.setRange(0, 1); // setup and fix the range of y-achses // domainAxis.setRange(0, 100); // setup and fix the range of x-achses rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // plot.getDomainAxis().setRange(0, 100); // setup the range of y-achses // OPTIONAL CUSTOMISATION COMPLETED. chartPanel = new ChartPanel(chart); getContentPane().add(chartPanel); }
From source file:br.prof.salesfilho.oci.image.GraphicBuilder.java
public void createChart() { chart = ChartFactory.createXYLineChart(this.title, this.xLabel, this.yLabel, this.collectionDataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(Color.white); final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); List<XYSeries> listSeries = collectionDataset.getSeries(); for (int i = 0; i < listSeries.size(); i++) { renderer.setSeriesLinesVisible(i, true); renderer.setSeriesShapesVisible(i, true); renderer.setSeriesShapesFilled(i, false); }/*from w w w.j a v a2 s .c o m*/ plot.setRenderer(renderer); plot.setRangePannable(true); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); chartPanel.setChart(chart); }
From source file:demo.AnimatingAddNodeDemo.java
@Override public void init() { //create a graph Graph<Number, Number> ig = Graphs .<Number, Number>synchronizedDirectedGraph(new DirectedSparseMultigraph<Number, Number>()); ObservableGraph<Number, Number> og = new ObservableGraph<Number, Number>(ig); og.addGraphEventListener(new GraphEventListener<Number, Number>() { public void handleGraphEvent(GraphEvent<Number, Number> evt) { System.err.println("got " + evt); }/*from ww w .ja va2 s . c o m*/ }); this.g = og; //create a graphdraw layout = new FRLayout<Number, Number>(g); layout.setSize(new Dimension(600, 600)); Relaxer relaxer = new VisRunner((IterativeContext) layout); relaxer.stop(); relaxer.prerelax(); Layout<Number, Number> staticLayout = new StaticLayout<Number, Number>(g, layout); vv = new VisualizationViewer<Number, Number>(staticLayout, new Dimension(600, 600)); JRootPane rp = this.getRootPane(); rp.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE); getContentPane().setLayout(new BorderLayout()); getContentPane().setBackground(java.awt.Color.lightGray); getContentPane().setFont(new Font("Serif", Font.PLAIN, 12)); vv.setGraphMouse(new DefaultModalGraphMouse<Number, Number>()); vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<Number>()); vv.setForeground(Color.white); vv.addComponentListener(new ComponentAdapter() { /** * @see java.awt.event.ComponentAdapter#componentResized(java.awt.event.ComponentEvent) */ @Override public void componentResized(ComponentEvent arg0) { super.componentResized(arg0); layout.setSize(arg0.getComponent().getSize()); } }); getContentPane().add(vv); timer = new Timer(); }