List of usage examples for java.awt Color BLACK
Color BLACK
To view the source code for java.awt Color BLACK.
Click Source Link
From source file:RotationAboutCenter.java
protected void paintComponent(Graphics g) { Graphics2D g2d;// w ww.jav a 2 s. c om g2d = (Graphics2D) g.create(); // Erase background to white g2d.setColor(Color.WHITE); g2d.fillRect(0, 0, getWidth(), getHeight()); // base rectangle g2d.setColor(Color.GRAY.brighter()); g2d.fillRect(50, 50, 50, 50); // rotated 45 degrees around origin g2d.rotate(Math.toRadians(45)); g2d.setColor(Color.GRAY.darker()); g2d.fillRect(50, 50, 50, 50); // rotated 45 degrees about center of rect g2d = (Graphics2D) g.create(); g2d.rotate(Math.toRadians(45), 75, 75); g2d.setColor(Color.BLACK); g2d.fillRect(50, 50, 50, 50); // done with g2d, dispose it g2d.dispose(); }
From source file:eu.udig.tools.jgrass.profile.ProfileView.java
public void createPartControl(Composite parent) { series = new XYSeries("profile"); XYSeriesCollection lineDataset = new XYSeriesCollection(); lineDataset.addSeries(series);// w w w . ja v a 2 s. c o m JFreeChart result = ChartFactory.createXYAreaChart("", "Progressive distance", "Elevation", lineDataset, PlotOrientation.VERTICAL, true, true, false); plot = (XYPlot) result.getPlot(); ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); renderer = plot.getRenderer(); renderer.setSeriesPaint(0, Color.black); new ChartComposite(parent, SWT.None, result); Action action = new ExportChartData(); IActionBars actionBars = getViewSite().getActionBars(); IMenuManager dropDownMenu = actionBars.getMenuManager(); dropDownMenu.add(action); }
From source file:com.google.code.facebook.graph.sna.applet.ImageEdgeLabelDemo.java
public ImageEdgeLabelDemo() { // create a simple graph for the demo graph = new DirectedSparseMultigraph<Number, Number>(); createGraph(VERTEX_COUNT);// w ww. j a va 2 s. c om FRLayout<Number, Number> layout = new FRLayout<Number, Number>(graph); layout.setMaxIterations(100); vv = new VisualizationViewer<Number, Number>(layout, new Dimension(400, 400)); vv.getRenderContext().setEdgeDrawPaintTransformer( new PickableEdgePaintTransformer<Number>(vv.getPickedEdgeState(), Color.black, Color.cyan)); vv.setBackground(Color.white); vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.cyan)); vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.cyan)); vv.getRenderContext().setEdgeLabelTransformer(new Transformer<Number, String>() { URL url = getClass().getResource("/images/lightning-s.gif"); public String transform(Number input) { return "<html><img src=" + url + " height=10 width=21>"; } }); // add a listener for ToolTips vv.setVertexToolTipTransformer(new ToStringLabeller<Number>()); vv.setEdgeToolTipTransformer(new ToStringLabeller<Number>()); Container content = getContentPane(); final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); content.add(panel); final DefaultModalGraphMouse<Number, Number> graphMouse = new DefaultModalGraphMouse<Number, Number>(); vv.setGraphMouse(graphMouse); vv.addKeyListener(graphMouse.getModeKeyListener()); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); JComboBox modeBox = graphMouse.getModeComboBox(); JPanel modePanel = new JPanel(); modePanel.setBorder(BorderFactory.createTitledBorder("Mouse Mode")); modePanel.add(modeBox); JPanel scaleGrid = new JPanel(new GridLayout(1, 0)); scaleGrid.setBorder(BorderFactory.createTitledBorder("Zoom")); JPanel controls = new JPanel(); scaleGrid.add(plus); scaleGrid.add(minus); controls.add(scaleGrid); controls.add(modePanel); content.add(controls, BorderLayout.SOUTH); }
From source file:com.game.ui.views.MapEditor.java
public void generateGUI() throws IOException { setDefaultCloseOperation(DISPOSE_ON_CLOSE); // setResizable(false); JMenuBar menubar = new JMenuBar(); ImageIcon icon = null;//w w w .ja v a2 s. c o m try { icon = GameUtils.shrinkImage("save.png", 20, 20); } catch (IOException e) { System.out.println("Dialog : showDialogForMap(): Exception occured :" + e); e.printStackTrace(); } JMenu file = new JMenu("File"); JMenuItem save = new JMenuItem("Save", icon); save.setToolTipText("Save Map Information"); save.setActionCommand("Save Map"); save.addActionListener(this); file.add(save); menubar.add(file); setJMenuBar(menubar); JPanel topPanel = new JPanel(); topPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); topPanel.setLayout(new GridBagLayout()); JLabel headerLbl = new JLabel("Legend : "); headerLbl.setFont(new Font("Times New Roman", Font.BOLD, 15)); JLabel lbl1 = new JLabel(); lbl1.setPreferredSize(new Dimension(50, 20)); lbl1.setBackground(Configuration.pathColor); lbl1.setOpaque(true); JLabel lbl2 = new JLabel("- Represents the path."); JLabel lbl3 = new JLabel(); lbl3.setPreferredSize(new Dimension(50, 20)); lbl3.setBackground(Configuration.enemyColor); lbl3.setOpaque(true); JLabel lbl4 = new JLabel("- Represents the path with monsters"); JLabel lbl5 = new JLabel(); lbl5.setPreferredSize(new Dimension(50, 20)); lbl5.setBackground(Configuration.startPointColor); lbl5.setOpaque(true); JLabel lbl6 = new JLabel("- Represents the starting point in the path"); JLabel lbl7 = new JLabel(); lbl7.setBackground(Configuration.endPointColor); lbl7.setOpaque(true); lbl7.setPreferredSize(new Dimension(50, 20)); JLabel lbl8 = new JLabel("- Ending point in the path"); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.weightx = 1; c.weighty = 0; c.insets = new Insets(5, 5, 5, 5); c.gridwidth = 2; topPanel.add(headerLbl, c); c.fill = GridBagConstraints.NONE; c.gridx = 0; c.gridy = 1; c.weightx = 0; c.weighty = 0; c.gridwidth = 1; c.ipadx = 5; c.ipady = 5; topPanel.add(lbl1, c); c.gridx = 1; c.anchor = GridBagConstraints.FIRST_LINE_START; topPanel.add(lbl2, c); c.gridx = 0; c.gridy = 2; topPanel.add(lbl3, c); c.gridx = 1; topPanel.add(lbl4, c); c.gridx = 0; c.gridy = 3; topPanel.add(lbl5, c); c.gridx = 1; topPanel.add(lbl6, c); c.gridx = 0; c.gridy = 4; topPanel.add(lbl7, c); c.gridx = 1; topPanel.add(lbl8, c); add(topPanel, BorderLayout.NORTH); bottomPanel = new JPanel(); add(bottomPanel, BorderLayout.CENTER); bottomPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); // bottomPanel.add(new JButton("kaushik")); pack(); setExtendedState(JFrame.MAXIMIZED_BOTH); GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); setMaximizedBounds(env.getMaximumWindowBounds()); setVisible(true); callDialogForUsersInput(); }
From source file:mase.app.indiana.Indiana.java
@Override public void start() { super.start(); this.field = new Continuous2D(par.discretization, par.size, par.size); this.walls = new MultilineObject(field, new Double2D(0, par.size / 2 + par.gateSize / 2), new Double2D(0, par.size), new Double2D(par.size, par.size), new Double2D(par.size, 0), new Double2D(0, 0), new Double2D(0, par.size / 2 - par.gateSize / 2)); this.walls.filled = false; this.walls.paint = Color.BLACK; this.walls.setStroke(new BasicStroke(2f)); this.gate = new Gate(this, field); schedule.scheduleRepeating(gate);/*from w ww .ja v a2s .c om*/ field.setObjectLocation(gate, new Double2D(0.5, 0)); field.setObjectLocation(walls, new Double2D(0, 0)); placeAgents(); this.td = new TaskDescription(new EntityGroup(activeAgents, 0, agents.size(), false), new EntityGroup(Collections.singletonList(gate), 1, 1, true), new EntityGroup(Collections.singletonList(walls), 1, 1, true)); }
From source file:graficos.GenerarGraficoFinanciero.java
public void crear() { try {/* w w w. jav a 2s . c om*/ Dba db = new Dba(pathdb); db.conectar(); String sql = "select IdCategoria, Nombre from Categoria"; db.prepare(sql); db.query.execute(); ResultSet rs = db.query.getResultSet(); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); String fechai = periodo.substring(0, 10) + " 00:00:00"; String fechaf = periodo.substring(13, 23) + " 00:00:00"; while (rs.next()) { String sql1 = "select Monto from PagoCliente join FichaCliente on PagoCliente.IdFichaCliente=FichaCliente.IdFichaCliente" + " join Reservacion on Reservacion.IdReservacion=FichaCliente.IdReservacion join Habitacion on Reservacion.IdHabitacion=" + "Habitacion.IdHabitacion where Habitacion.IdCategoria=" + rs.getInt(1) + " and FichaCliente.FechaSalida>='" + fechai + "' and" + " FichaCliente.FechaSalida<='" + fechaf + "'"; db.prepare(sql1); db.query.execute(); ResultSet rs1 = db.query.getResultSet(); Double monto = 0.0; while (rs1.next()) { monto += rs1.getDouble(1); } dataset.setValue(monto, "Ingresos", rs.getString(2)); } JFreeChart chart = ChartFactory.createBarChart3D( "Comparacin de Ingresos por Categora\nPeriodo:" + periodo, "Categora", "Ingresos", dataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot p = chart.getCategoryPlot(); // Get the Plot object for a bar graph p.setBackgroundPaint(Color.black); try { ChartUtilities.saveChartAsJPEG(new File(path), chart, 500, 300); } catch (Exception ee) { System.err.println(ee.toString()); System.err.println("Problem occurred creating chart."); } db.desconectar(); } catch (Exception e) { } }
From source file:com.stefanbrenner.droplet.ui.DevicePanel.java
/** * Create the panel.// www. j a va 2 s . co m */ public DevicePanel(final JComponent parent, final IDroplet droplet, final T device) { this.parent = parent; setDevice(device); setLayout(new BorderLayout(0, 5)); setBorder(BorderFactory.createLineBorder(Color.BLACK)); setBackground(DropletColors.getBackgroundColor(device)); BeanAdapter<T> adapter = new BeanAdapter<T>(device, true); // device name textfield txtName = BasicComponentFactory.createTextField(adapter.getValueModel(IDevice.PROPERTY_NAME)); txtName.setHorizontalAlignment(SwingConstants.CENTER); txtName.setColumns(1); txtName.setToolTipText(device.getName()); adapter.addBeanPropertyChangeListener(IDevice.PROPERTY_NAME, new PropertyChangeListener() { @Override public void propertyChange(final PropertyChangeEvent event) { txtName.setToolTipText(device.getName()); } }); add(txtName, BorderLayout.NORTH); // actions panel with scroll pane actionsPanel = new JPanel(); actionsPanel.setLayout(new BoxLayout(actionsPanel, BoxLayout.Y_AXIS)); actionsPanel.setBackground(getBackground()); JScrollPane scrollPane = new JScrollPane(actionsPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); // resize vertical scrollbar scrollPane.getVerticalScrollBar().putClientProperty("JComponent.sizeVariant", "mini"); //$NON-NLS-1$ //$NON-NLS-2$ SwingUtilities.updateComponentTreeUI(scrollPane); // we need no border scrollPane.setBorder(BorderFactory.createEmptyBorder()); add(scrollPane, BorderLayout.CENTER); { JPanel panel = new JPanel(); panel.setLayout(new GridLayout(0, 1)); createAddButton(panel); // remove button JButton btnRemove = new JButton(Messages.getString("ActionDevicePanel.removeDevice")); //$NON-NLS-1$ btnRemove.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent action) { int retVal = JOptionPane.showConfirmDialog(DevicePanel.this, Messages.getString("ActionDevicePanel.removeDevice") + " '" + device.getName() + "'?", //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ StringUtils.EMPTY, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (retVal == JOptionPane.YES_OPTION) { droplet.removeDevice(device); } } }); btnRemove.setFocusable(false); panel.add(btnRemove); add(panel, BorderLayout.SOUTH); } }
From source file:finale.year.stage.main.forgotLogin.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor./* ww w . j a va 2s .co m*/ */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; forgotPassPanel = new javax.swing.JPanel(); cancelBtn = new javax.swing.JButton(); submitBtn = new javax.swing.JButton(); emailField = new javax.swing.JTextField(); emailLabel = new javax.swing.JLabel(); submitLabel = new javax.swing.JLabel(); credentialPanel = new javax.swing.JPanel(); loginKeyLabel = new javax.swing.JLabel(); loginKeyField = new javax.swing.JTextField(); newPassLabel = new javax.swing.JLabel(); confirmLabel = new javax.swing.JLabel(); passwordField = new javax.swing.JPasswordField(); confirmPassField = new javax.swing.JPasswordField(); setBackground(new java.awt.Color(85, 172, 238)); setLayout(new java.awt.GridBagLayout()); forgotPassPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Forgot Password", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.ABOVE_TOP, new java.awt.Font("Abyssinica SIL", 1, 18), java.awt.Color.black)); // NOI18N forgotPassPanel.setPreferredSize(new java.awt.Dimension(750, 450)); cancelBtn.setText("Cancel"); cancelBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelBtnActionPerformed(evt); } }); submitBtn.setText("Submit"); submitBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { submitBtnActionPerformed(evt); } }); emailField.setColumns(20); emailField.setAutoscrolls(false); emailLabel.setText("Email :"); submitLabel.setForeground(new java.awt.Color(220, 81, 35)); submitLabel.setText("Submit a valid Email Address"); credentialPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Re-intialise Credentials", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Courier 10 Pitch", 1, 18), java.awt.Color.red)); // NOI18N credentialPanel.setEnabled(false); loginKeyLabel.setText("Recovery Code :"); loginKeyField.setEnabled(false); newPassLabel.setText("New Password :"); confirmLabel.setText("Confirm :"); passwordField.setToolTipText(""); passwordField.setEnabled(false); confirmPassField.setEnabled(false); javax.swing.GroupLayout credentialPanelLayout = new javax.swing.GroupLayout(credentialPanel); credentialPanel.setLayout(credentialPanelLayout); credentialPanelLayout.setHorizontalGroup(credentialPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(credentialPanelLayout.createSequentialGroup().addGroup(credentialPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, credentialPanelLayout.createSequentialGroup().addContainerGap() .addGroup(credentialPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(newPassLabel).addComponent(confirmLabel)) .addGap(18, 18, 18) .addGroup(credentialPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(loginKeyField, javax.swing.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE) .addComponent(confirmPassField).addComponent(passwordField, javax.swing.GroupLayout.Alignment.TRAILING))) .addGroup(credentialPanelLayout.createSequentialGroup().addGap(12, 12, 12) .addComponent(loginKeyLabel).addGap(0, 0, Short.MAX_VALUE))) .addContainerGap())); credentialPanelLayout.setVerticalGroup( credentialPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(credentialPanelLayout.createSequentialGroup().addContainerGap() .addGroup(credentialPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(loginKeyLabel).addComponent(loginKeyField, javax.swing.GroupLayout.DEFAULT_SIZE, 34, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(credentialPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(newPassLabel).addComponent(passwordField, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(credentialPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(credentialPanelLayout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(confirmLabel).addGap(22, 22, 22)) .addGroup(credentialPanelLayout.createSequentialGroup().addGap(6, 6, 6) .addComponent(confirmPassField, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())))); javax.swing.GroupLayout forgotPassPanelLayout = new javax.swing.GroupLayout(forgotPassPanel); forgotPassPanel.setLayout(forgotPassPanelLayout); forgotPassPanelLayout.setHorizontalGroup(forgotPassPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( forgotPassPanelLayout.createSequentialGroup().addGap(12, 12, 12).addComponent(submitLabel)) .addGroup(forgotPassPanelLayout.createSequentialGroup().addGap(12, 12, 12) .addComponent(emailLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(emailField, javax.swing.GroupLayout.PREFERRED_SIZE, 442, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(forgotPassPanelLayout.createSequentialGroup().addGap(12, 12, 12).addComponent( credentialPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(forgotPassPanelLayout.createSequentialGroup().addGap(457, 457, 457) .addComponent(cancelBtn).addGap(21, 21, 21).addComponent(submitBtn))); forgotPassPanelLayout.setVerticalGroup( forgotPassPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(forgotPassPanelLayout.createSequentialGroup().addGap(23, 23, 23) .addComponent(submitLabel).addGap(6, 6, 6) .addGroup(forgotPassPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(forgotPassPanelLayout.createSequentialGroup().addGap(10, 10, 10) .addComponent(emailLabel)) .addComponent(emailField, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(6, 6, 6) .addComponent(credentialPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(6, 6, 6) .addGroup(forgotPassPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(cancelBtn).addComponent(submitBtn)))); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.ipadx = 13; gridBagConstraints.ipady = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(123, 132, 154, 88); add(forgotPassPanel, gridBagConstraints); }
From source file:edu.uci.ics.jung.samples.ImageEdgeLabelDemo.java
@SuppressWarnings("rawtypes") public ImageEdgeLabelDemo() { // create a simple graph for the demo graph = new DirectedSparseMultigraph<Number, Number>(); createGraph(VERTEX_COUNT);/*w ww .j ava 2 s . c o m*/ FRLayout<Number, Number> layout = new FRLayout<Number, Number>(graph); layout.setMaxIterations(100); vv = new VisualizationViewer<Number, Number>(layout, new Dimension(400, 400)); vv.getRenderContext().setEdgeDrawPaintTransformer( new PickableEdgePaintTransformer<Number>(vv.getPickedEdgeState(), Color.black, Color.cyan)); vv.setBackground(Color.white); vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.cyan)); vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.cyan)); vv.getRenderContext().setEdgeLabelTransformer(new Transformer<Number, String>() { URL url = getClass().getResource("/images/lightning-s.gif"); public String transform(Number input) { return "<html><img src=" + url + " height=10 width=21>"; } }); // add a listener for ToolTips vv.setVertexToolTipTransformer(new ToStringLabeller<Number>()); vv.setEdgeToolTipTransformer(new ToStringLabeller<Number>()); Container content = getContentPane(); final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); content.add(panel); final DefaultModalGraphMouse<Number, Number> graphMouse = new DefaultModalGraphMouse<Number, Number>(); vv.setGraphMouse(graphMouse); vv.addKeyListener(graphMouse.getModeKeyListener()); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); JComboBox modeBox = graphMouse.getModeComboBox(); JPanel modePanel = new JPanel(); modePanel.setBorder(BorderFactory.createTitledBorder("Mouse Mode")); modePanel.add(modeBox); JPanel scaleGrid = new JPanel(new GridLayout(1, 0)); scaleGrid.setBorder(BorderFactory.createTitledBorder("Zoom")); JPanel controls = new JPanel(); scaleGrid.add(plus); scaleGrid.add(minus); controls.add(scaleGrid); controls.add(modePanel); content.add(controls, BorderLayout.SOUTH); }
From source file:josejamilena.pfc.analizador.GraficoPorScript.java
public GraficoPorScript(final String hostCliente, final String hostSgbd) throws ClassNotFoundException, SQLException { Map<String, String> res = new TreeMap<String, String>(); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); Statement stmt = null;/*w w w. j a va2s.c o m*/ ResultSet rs = null; String consulta = "select tiempo, fecha from estadisticas where host_cliente=\'" + hostCliente + "\' and host_sgbd=\'" + hostSgbd + "\'"; stmt = App.conn.createStatement(); rs = stmt.executeQuery(consulta); while (rs.next()) { res.put(rs.getString(2), rs.getString(1)); } rs.close(); stmt.close(); Iterator it = res.entrySet().iterator(); while (it.hasNext()) { Map.Entry pairs = (Map.Entry) it.next(); dataset.setValue(Double.parseDouble(pairs.getValue().toString()), hostCliente, pairs.getKey().toString()); } JFreeChart chart = ChartFactory.createBarChart(hostCliente + " / " + hostSgbd, // chart title "Hora", // domain axis label "Duracin (milisegundos)", // range axis label dataset, // data PlotOrientation.HORIZONTAL, false, // include legend true, false); CategoryPlot plot = chart.getCategoryPlot(); chart.setBackgroundPaint(Color.white); plot.setOutlinePaint(Color.black); ChartPanel chartPanel = new ChartPanel(chart); JScrollPane scrollPane = new JScrollPane(); scrollPane.getViewport().add((new JPanel()).add(chartPanel)); setContentPane(scrollPane); }