List of usage examples for java.awt Color DARK_GRAY
Color DARK_GRAY
To view the source code for java.awt Color DARK_GRAY.
Click Source Link
From source file:net.sf.jasperreports.chartthemes.spring.AegeanChartTheme.java
@Override protected JFreeChart createGanttChart() throws JRException { JFreeChart jfreeChart = super.createGanttChart(); CategoryPlot categoryPlot = (CategoryPlot) jfreeChart.getPlot(); categoryPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.STANDARD); categoryPlot.setDomainGridlinesVisible(true); categoryPlot.setDomainGridlinePosition(CategoryAnchor.END); categoryPlot.setDomainGridlineStroke( new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] { 1 }, 0)); categoryPlot.setDomainGridlinePaint(ChartThemesConstants.GRAY_PAINT_217); categoryPlot.setRangeGridlinesVisible(true); categoryPlot.setRangeGridlineStroke( new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] { 1 }, 0)); categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_217); // JRBarPlot barPlot = (BarPlot)categoryPlot; // categoryPlot.getDomainAxis().setTickLabelsVisible( // categoryPlot.getShowTickLabels() == null ? true : barPlot.getShowTickLabels(). // true // ); CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer(); categoryRenderer.setBaseItemLabelsVisible(true); BarRenderer barRenderer = (BarRenderer) categoryRenderer; @SuppressWarnings("unchecked") List<Paint> seriesPaints = (List<Paint>) getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SERIES_COLORS); barRenderer.setSeriesPaint(0, seriesPaints.get(3)); barRenderer.setSeriesPaint(1, seriesPaints.get(0)); CategoryDataset categoryDataset = categoryPlot.getDataset(); if (categoryDataset != null) { for (int i = 0; i < categoryDataset.getRowCount(); i++) { barRenderer.setSeriesItemLabelFont(i, categoryPlot.getDomainAxis().getTickLabelFont()); barRenderer.setSeriesItemLabelsVisible(i, true); // barRenderer.setSeriesPaint(i, GRADIENT_PAINTS[i]); // CategoryMarker categoryMarker = new CategoryMarker(categoryDataset.getColumnKey(i),MARKER_COLOR, new BasicStroke(1f)); // categoryMarker.setAlpha(0.5f); // categoryPlot.addDomainMarker(categoryMarker, Layer.BACKGROUND); }/*from w ww. j a va 2s .com*/ } categoryPlot.setOutlinePaint(Color.DARK_GRAY); categoryPlot.setOutlineStroke(new BasicStroke(1.5f)); categoryPlot.setOutlineVisible(true); return jfreeChart; }
From source file:userinterface.StateNetworkAdminRole.StateReportsJPanel.java
private JFreeChart createPatientReportsChart(CategoryDataset dataset) { JFreeChart barChart = ChartFactory.createBarChart("Average Waiting period of Patients", "Year", "Avg Waiting period(months)", dataset, PlotOrientation.VERTICAL, true, true, false); barChart.setBackgroundPaint(Color.white); // Set the background color of the chart barChart.getTitle().setPaint(Color.DARK_GRAY); barChart.setBorderVisible(true);/*from w ww.j av a 2 s. c o m*/ // Adjust the color of the title CategoryPlot plot = barChart.getCategoryPlot(); plot.getRangeAxis().setLowerBound(0.0); // Get the Plot object for a bar graph plot.setBackgroundPaint(Color.white); plot.setRangeGridlinePaint(Color.blue); CategoryItemRenderer renderer = plot.getRenderer(); renderer.setSeriesPaint(0, Color.decode("#00008B")); //return chart; return barChart; }
From source file:ca.uhn.hl7v2.testpanel.ui.editor.Hl7V2MessageEditorPanel.java
/** * Create the panel.// ww w .j a v a 2s. c o m */ public Hl7V2MessageEditorPanel(final Controller theController) { setBorder(null); myController = theController; ButtonGroup encGrp = new ButtonGroup(); setLayout(new BorderLayout(0, 0)); mysplitPane = new JSplitPane(); mysplitPane.setResizeWeight(0.5); mysplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); add(mysplitPane); mysplitPane.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent theEvt) { double ratio = (double) mysplitPane.getDividerLocation() / mysplitPane.getHeight(); ourLog.debug("Resizing split to ratio: {}", ratio); Prefs.getInstance().setHl7EditorSplit(ratio); } }); EventQueue.invokeLater(new Runnable() { public void run() { mysplitPane.setDividerLocation(Prefs.getInstance().getHl7EditorSplit()); } }); messageEditorContainerPanel = new JPanel(); messageEditorContainerPanel.setBorder(null); mysplitPane.setRightComponent(messageEditorContainerPanel); messageEditorContainerPanel.setLayout(new BorderLayout(0, 0)); myMessageEditor = new JEditorPane(); Highlighter h = new UnderlineHighlighter(); myMessageEditor.setHighlighter(h); // myMessageEditor.setFont(Prefs.getHl7EditorFont()); myMessageEditor.setSelectedTextColor(Color.black); myMessageEditor.setCaret(new EditorCaret()); myMessageScrollPane = new JScrollPane(myMessageEditor); messageEditorContainerPanel.add(myMessageScrollPane); JToolBar toolBar = new JToolBar(); messageEditorContainerPanel.add(toolBar, BorderLayout.NORTH); toolBar.setFloatable(false); toolBar.setRollover(true); myFollowToggle = new JToggleButton("Follow"); myFollowToggle.setToolTipText("Keep the message tree (above) and the message editor (below) in sync"); myFollowToggle.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { theController.setMessageEditorInFollowMode(myFollowToggle.isSelected()); } }); myFollowToggle.setIcon(new ImageIcon( Hl7V2MessageEditorPanel.class.getResource("/ca/uhn/hl7v2/testpanel/images/updown.png"))); myFollowToggle.setSelected(theController.isMessageEditorInFollowMode()); toolBar.add(myFollowToggle); myhorizontalStrut = Box.createHorizontalStrut(20); toolBar.add(myhorizontalStrut); mylabel_4 = new JLabel("Encoding"); toolBar.add(mylabel_4); myRdbtnEr7 = new JRadioButton("ER7"); myRdbtnEr7.setMargin(new Insets(1, 2, 0, 1)); toolBar.add(myRdbtnEr7); myRdbtnXml = new JRadioButton("XML"); myRdbtnXml.setMargin(new Insets(1, 5, 0, 1)); toolBar.add(myRdbtnXml); encGrp.add(myRdbtnEr7); encGrp.add(myRdbtnXml); treeContainerPanel = new JPanel(); mysplitPane.setLeftComponent(treeContainerPanel); treeContainerPanel.setLayout(new BorderLayout(0, 0)); mySpinnerIconOn = new ImageIcon( Hl7V2MessageEditorPanel.class.getResource("/ca/uhn/hl7v2/testpanel/images/spinner.gif")); mySpinnerIconOff = new ImageIcon(); myTreePanel = new Hl7V2MessageTree(theController); myTreePanel.setWorkingListener(new IWorkingListener() { public void startedWorking() { mySpinner.setText(""); mySpinner.setIcon(mySpinnerIconOn); mySpinnerIconOn.setImageObserver(mySpinner); } public void finishedWorking(String theStatus) { mySpinner.setText(theStatus); mySpinner.setIcon(mySpinnerIconOff); mySpinnerIconOn.setImageObserver(null); } }); myTreeScrollPane = new JScrollPane(myTreePanel); myTopTabBar = new JTabbedPane(); treeContainerPanel.add(myTopTabBar); myTopTabBar.setBorder(null); JPanel treeContainer = new JPanel(); treeContainer.setLayout(new BorderLayout(0, 0)); treeContainer.add(myTreeScrollPane); myTopTabBar.add("Message Tree", treeContainer); mytoolBar_1 = new JToolBar(); mytoolBar_1.setFloatable(false); treeContainer.add(mytoolBar_1, BorderLayout.NORTH); mylabel_3 = new JLabel("Show"); mytoolBar_1.add(mylabel_3); myShowCombo = new JComboBox(); mytoolBar_1.add(myShowCombo); myShowCombo.setPreferredSize(new Dimension(130, 27)); myShowCombo.setMinimumSize(new Dimension(130, 27)); myShowCombo.setMaximumSize(new Dimension(130, 32767)); collapseAllButton = new JButton(); collapseAllButton.setBorderPainted(false); collapseAllButton.addMouseListener(new HoverButtonMouseAdapter(collapseAllButton)); collapseAllButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { myTreePanel.collapseAll(); } }); collapseAllButton.setToolTipText("Collapse All"); collapseAllButton.setIcon(new ImageIcon( Hl7V2MessageEditorPanel.class.getResource("/ca/uhn/hl7v2/testpanel/images/collapse_all.png"))); mytoolBar_1.add(collapseAllButton); expandAllButton = new JButton(); expandAllButton.setBorderPainted(false); expandAllButton.addMouseListener(new HoverButtonMouseAdapter(expandAllButton)); expandAllButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { myTreePanel.expandAll(); } }); expandAllButton.setToolTipText("Expand All"); expandAllButton.setIcon(new ImageIcon( Hl7V2MessageEditorPanel.class.getResource("/ca/uhn/hl7v2/testpanel/images/expand_all.png"))); mytoolBar_1.add(expandAllButton); myhorizontalGlue = Box.createHorizontalGlue(); mytoolBar_1.add(myhorizontalGlue); mySpinner = new JButton(""); mySpinner.setForeground(Color.DARK_GRAY); mySpinner.setHorizontalAlignment(SwingConstants.RIGHT); mySpinner.setMaximumSize(new Dimension(200, 15)); mySpinner.setPreferredSize(new Dimension(200, 15)); mySpinner.setMinimumSize(new Dimension(200, 15)); mySpinner.setBorderPainted(false); mySpinner.setSize(new Dimension(16, 16)); mytoolBar_1.add(mySpinner); myProfileComboboxModel = new ProfileComboModel(); myTablesComboModel = new TablesComboModel(myController); mytoolBar = new JToolBar(); mytoolBar.setFloatable(false); mytoolBar.setRollover(true); treeContainerPanel.add(mytoolBar, BorderLayout.NORTH); myOutboundInterfaceCombo = new JComboBox(); myOutboundInterfaceComboModel = new DefaultComboBoxModel(); mylabel_1 = new JLabel("Send"); mytoolBar.add(mylabel_1); myOutboundInterfaceCombo.setModel(myOutboundInterfaceComboModel); myOutboundInterfaceCombo.setMaximumSize(new Dimension(200, 32767)); mytoolBar.add(myOutboundInterfaceCombo); mySendButton = new JButton("Send"); mySendButton.addMouseListener(new HoverButtonMouseAdapter(mySendButton)); mySendButton.setBorderPainted(false); mySendButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // int selectedIndex = // myOutboundInterfaceComboModel.getIndexOf(myOutboundInterfaceComboModel.getSelectedItem()); int selectedIndex = myOutboundInterfaceCombo.getSelectedIndex(); OutboundConnection connection = myController.getOutboundConnectionList().getConnections() .get(selectedIndex); activateSendingActivityTabForConnection(connection); myController.sendMessages(connection, myMessage, mySendingActivityTable.provideTransmissionCallback()); } }); myhorizontalStrut_2 = Box.createHorizontalStrut(20); myhorizontalStrut_2.setPreferredSize(new Dimension(2, 0)); myhorizontalStrut_2.setMinimumSize(new Dimension(2, 0)); myhorizontalStrut_2.setMaximumSize(new Dimension(2, 32767)); mytoolBar.add(myhorizontalStrut_2); mySendOptionsButton = new JButton("Options"); mySendOptionsButton.setBorderPainted(false); final HoverButtonMouseAdapter sendOptionsHoverAdaptor = new HoverButtonMouseAdapter(mySendOptionsButton); mySendOptionsButton.addMouseListener(sendOptionsHoverAdaptor); mySendOptionsButton.setIcon(new ImageIcon( Hl7V2MessageEditorPanel.class.getResource("/ca/uhn/hl7v2/testpanel/images/sendoptions.png"))); mytoolBar.add(mySendOptionsButton); mySendOptionsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent theE) { if (mySendOptionsPopupDialog != null) { mySendOptionsPopupDialog.doHide(); mySendOptionsPopupDialog = null; return; } mySendOptionsPopupDialog = new SendOptionsPopupDialog(Hl7V2MessageEditorPanel.this, myMessage, mySendOptionsButton, sendOptionsHoverAdaptor); Point los = mySendOptionsButton.getLocationOnScreen(); mySendOptionsPopupDialog.setLocation(los.x, los.y + mySendOptionsButton.getHeight()); mySendOptionsPopupDialog.setVisible(true); } }); mySendButton.setIcon(new ImageIcon( Hl7V2MessageEditorPanel.class.getResource("/ca/uhn/hl7v2/testpanel/images/button_execute.png"))); mytoolBar.add(mySendButton); myhorizontalStrut_1 = Box.createHorizontalStrut(20); mytoolBar.add(myhorizontalStrut_1); mylabel_2 = new JLabel("Validate"); mytoolBar.add(mylabel_2); myProfileCombobox = new JComboBox(); mytoolBar.add(myProfileCombobox); myProfileCombobox.setPreferredSize(new Dimension(200, 27)); myProfileCombobox.setMinimumSize(new Dimension(200, 27)); myProfileCombobox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (myHandlingProfileComboboxChange) { return; } myHandlingProfileComboboxChange = true; try { if (myProfileCombobox.getSelectedIndex() == 0) { myMessage.setValidationContext(null); } else if (myProfileCombobox.getSelectedIndex() == 1) { myMessage.setValidationContext(new DefaultValidation()); } else if (myProfileCombobox.getSelectedIndex() > 0) { ProfileGroup profile = myProfileComboboxModel.myProfileGroups .get(myProfileCombobox.getSelectedIndex()); myMessage.setRuntimeProfile(profile); // } else if (myProfileCombobox.getSelectedItem() == // ProfileComboModel.APPLY_CONFORMANCE_PROFILE) { // IOkCancelCallback<Void> callback = new // IOkCancelCallback<Void>() { // public void ok(Void theArg) { // myProfileComboboxModel.update(); // } // // public void cancel(Void theArg) { // myProfileCombobox.setSelectedIndex(0); // } // }; // myController.chooseAndLoadConformanceProfileForMessage(myMessage, // callback); } } catch (ProfileException e2) { ourLog.error("Failed to load profile", e2); } finally { myHandlingProfileComboboxChange = false; } } }); myProfileCombobox.setMaximumSize(new Dimension(300, 32767)); myProfileCombobox.setModel(myProfileComboboxModel); myhorizontalStrut_4 = Box.createHorizontalStrut(20); myhorizontalStrut_4.setPreferredSize(new Dimension(2, 0)); myhorizontalStrut_4.setMinimumSize(new Dimension(2, 0)); myhorizontalStrut_4.setMaximumSize(new Dimension(2, 32767)); mytoolBar.add(myhorizontalStrut_4); // mySendingPanel = new JPanel(); // mySendingPanel.setBorder(null); // myTopTabBar.addTab("Sending", null, mySendingPanel, null); // mySendingPanel.setLayout(new BorderLayout(0, 0)); mySendingActivityTable = new ActivityTable(); mySendingActivityTable.setController(myController); myTopTabBar.addTab("Sending", null, mySendingActivityTable, null); // mySendingPanelScrollPanel = new JScrollPane(); // mySendingPanelScrollPanel.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); // mySendingPanelScrollPanel.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); // mySendingPanelScrollPanel.setColumnHeaderView(mySendingActivityTable); // // mySendingPanel.add(mySendingPanelScrollPanel, BorderLayout.CENTER); bottomPanel = new JPanel(); bottomPanel.setPreferredSize(new Dimension(10, 20)); bottomPanel.setMinimumSize(new Dimension(10, 20)); add(bottomPanel, BorderLayout.SOUTH); GridBagLayout gbl_bottomPanel = new GridBagLayout(); gbl_bottomPanel.columnWidths = new int[] { 98, 74, 0 }; gbl_bottomPanel.rowHeights = new int[] { 16, 0 }; gbl_bottomPanel.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE }; gbl_bottomPanel.rowWeights = new double[] { 0.0, Double.MIN_VALUE }; bottomPanel.setLayout(gbl_bottomPanel); mylabel = new JLabel("Terser Path:"); mylabel.setHorizontalTextPosition(SwingConstants.LEFT); mylabel.setHorizontalAlignment(SwingConstants.LEFT); GridBagConstraints gbc_label = new GridBagConstraints(); gbc_label.fill = GridBagConstraints.VERTICAL; gbc_label.weighty = 1.0; gbc_label.anchor = GridBagConstraints.NORTHWEST; gbc_label.gridx = 0; gbc_label.gridy = 0; bottomPanel.add(mylabel, gbc_label); myTerserPathTextField = new JLabel(); myTerserPathTextField.setForeground(Color.BLUE); myTerserPathTextField.setFont(new Font("Lucida Console", Font.PLAIN, 13)); myTerserPathTextField.setBorder(null); myTerserPathTextField.setBackground(SystemColor.control); myTerserPathTextField.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (StringUtils.isNotEmpty(myTerserPathTextField.getText())) { myTerserPathPopupMenu.show(myTerserPathTextField, 0, 0); } } }); GridBagConstraints gbc_TerserPathTextField = new GridBagConstraints(); gbc_TerserPathTextField.weightx = 1.0; gbc_TerserPathTextField.fill = GridBagConstraints.HORIZONTAL; gbc_TerserPathTextField.gridx = 1; gbc_TerserPathTextField.gridy = 0; bottomPanel.add(myTerserPathTextField, gbc_TerserPathTextField); initLocal(); }
From source file:org.cytoscape.kddn.internal.KddnExperiment.java
/** * Create visual style for single condition * @param vmmServiceRef/*from w ww. j ava 2 s.c o m*/ * @param vsfServiceRef * @param vmfFactoryC * @param vmfFactoryD * @param vmfFactoryP * @return */ private VisualStyle createVisualStyleSingle(VisualMappingManager vmmServiceRef, VisualStyleFactory vsfServiceRef, VisualMappingFunctionFactory vmfFactoryC, VisualMappingFunctionFactory vmfFactoryD, VisualMappingFunctionFactory vmfFactoryP) { // retrieve visual style if already exist if (styleExist(vmmServiceRef, "KDDN visual style - single condition")) return getVSstyle(vmmServiceRef, "KDDN visual style - single condition"); // node color setting Color NODE_COLOR = new Color(230, 191, 85); Color NODE_BORDER_COLOR = Color.WHITE; Color NODE_LABEL_COLOR = new Color(50, 50, 50); // To create a new VisualStyle object and set the mapping function VisualStyle vs = vsfServiceRef.createVisualStyle("KDDN visual style - single condition"); // unlock node size Set<VisualPropertyDependency<?>> deps = vs.getAllVisualPropertyDependencies(); for (VisualPropertyDependency<?> dep : deps) { dep.setDependency(false); } // set node related default vs.setDefaultValue(BasicVisualLexicon.NODE_SHAPE, NodeShapeVisualProperty.ELLIPSE); vs.setDefaultValue(BasicVisualLexicon.NODE_FILL_COLOR, NODE_COLOR); vs.setDefaultValue(BasicVisualLexicon.NODE_LABEL_COLOR, NODE_LABEL_COLOR); vs.setDefaultValue(BasicVisualLexicon.NODE_BORDER_PAINT, NODE_BORDER_COLOR); vs.setDefaultValue(BasicVisualLexicon.NODE_TRANSPARENCY, 220); vs.setDefaultValue(BasicVisualLexicon.NODE_LABEL_FONT_SIZE, 20); // map node names String nodeName = "name"; PassthroughMapping nodeNameMapping = (PassthroughMapping) vmfFactoryP.createVisualMappingFunction(nodeName, String.class, BasicVisualLexicon.NODE_LABEL); vs.addVisualMappingFunction(nodeNameMapping); // map edge color String edgeType = "interaction"; DiscreteMapping<String, Paint> edgeTypeMapping = (DiscreteMapping<String, Paint>) vmfFactoryD .createVisualMappingFunction(edgeType, String.class, BasicVisualLexicon.EDGE_STROKE_UNSELECTED_PAINT); edgeTypeMapping.putMapValue("static edge", Color.DARK_GRAY); vs.addVisualMappingFunction(edgeTypeMapping); // add visual style if not added if (!styleExist(vmmServiceRef, "KDDN visual style - single condition")) vmmServiceRef.addVisualStyle(vs); return vs; }
From source file:network.view.relacoesEntidadesUI.GraphViewEntity.java
@SuppressWarnings("deprecation") public GraphViewEntity(Grafo g) { try {/* ww w .j a v a 2 s .c o m*/ //this.grafo = g; graph = getGraph(g); } catch (Exception e) { graph = TestGraphs.getOneComponentGraph(); } vv = paintGraph(graph, g); frame = new JFrame("Relao entre Entidades"); Container content = frame.getContentPane(); panel = new JPanel(new BorderLayout()); panel.add(vv); content.add(panel); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setIconImage(SwingResourceManager.getImage(GraphViewEntity.class, "/br/atech/smartsearch/view/images/logo-small.JPG")); dialog = new JDialog(frame); content = dialog.getContentPane(); // create the BirdsEyeView for zoom/pan final edu.uci.ics.jung.visualization.BirdsEyeVisualizationViewer bird = new edu.uci.ics.jung.visualization.BirdsEyeVisualizationViewer( vv, 0.25f, 0.25f); JButton reset = new JButton("Sem Zoom"); // 'reset' unzooms the graph via the Lens reset.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { bird.resetLens(); } }); final ScalingControl scaler = new ViewScalingControl(); 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, 0.9f, vv.getCenter()); } }); JButton help = new JButton("Ajuda"); help.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String zoomHelp = "<html><center>Arraste o retngulo azul para deslocar a imagem<p>" + "Arraste um lado do retngulo para ajustar o zoom</center></html>"; JOptionPane.showMessageDialog(dialog, zoomHelp); } }); JPanel controls = new JPanel(new GridLayout(2, 2)); controls.add(plus); controls.add(minus); controls.add(reset); controls.add(help); content.add(bird); content.add(controls, BorderLayout.SOUTH); JButton zoomer = new JButton("Mostrar tela de zoom"); zoomer.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.pack(); int w = dialog.getWidth() + 5; int h = dialog.getHeight() + 5; // 35; dialog.setLocation((int) (frame.getLocationOnScreen().getX() + frame.getWidth() - w), (int) frame.getLocationOnScreen().getY() + frame.getHeight() - h); //dialog.show(); dialog.setVisible(true); //bird.initLens(); } }); // [mcrb] Popup menu (Agrupar/Remover/Remover Selecao) popup = new JPopupMenu(); menuItem = new JMenuItem("Agrupar Nodos"); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //TODO } }); popup.add(menuItem); menuItem = new JMenuItem("Remover Nodo"); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { myVertexDisplayPredicate.filter(true); clicksFiltro.add(selecionado); pr.setVertexPaintFunction(new MyVertexPaintFunction()); vv.repaint(); } }); popup.add(menuItem); menuItem = new JMenuItem("Remover Seleo"); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { clicks = new ArrayList<Vertex>(); pr.setVertexPaintFunction(new MyVertexPaintFunction()); // para evitar que o 'ultimo selecionado permaneca em destaque: selecionado = null; vv.repaint(); } }); popup.add(menuItem); labelFiltroArestas = new JLabel("Apresentar arestas com tamanho maior que "); textFieldFiltroArestas = new JTextField(2); buttonFiltroArestas = new JButton("Filtrar"); buttonEliminarFiltroArestas = new JButton("Remover Filtros"); buttonEliminarFiltroArestas.setEnabled(false); buttonFiltroArestas.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Object objValue = textFieldFiltroArestas.getText(); try { new Integer((String) objValue).intValue(); } catch (NumberFormatException ex) { objValue = "0"; textFieldFiltroArestas.setText(""); } espessurasSelecionadas.add(objValue); myEdgeDisplayPredicate.filter(true, espessurasSelecionadas.toArray()); buttonEliminarFiltroArestas.setEnabled(true); vv.repaint(); } }); buttonEliminarFiltroArestas.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textFieldFiltroArestas.setText(""); espessurasSelecionadas = new ArrayList<Object>(); myEdgeDisplayPredicate.filter(false, espessurasSelecionadas.toArray()); vv.repaint(); } }); JPanel p = new JPanel(); p.setLayout(new FlowLayout(FlowLayout.LEFT)); // [inicio] acrescimo dos botoes de zoom JButton mais = new JButton(); mais.setToolTipText("Ampliar"); mais.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1)); mais.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton menos = new JButton(); menos.setToolTipText("Reduzir"); menos.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1)); menos.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); // [fim] acrescimo dos botoes de zoom final Color[] cores = { Color.BLACK, Color.BLUE, Color.CYAN, Color.DARK_GRAY, Color.GRAY, Color.GREEN, Color.MAGENTA, Color.ORANGE, Color.RED }; JButton agrupamento = new JButton("Agrupar"); agrupamento.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { clusterAndRecolor(new SubLayoutDecorator(new FRLayout(graph)), 1, cores, true); vv.validate(); vv.repaint(); } }); p.add(mais); p.add(menos); p.add(zoomer); p.add(labelFiltroArestas); p.add(textFieldFiltroArestas); p.add(buttonFiltroArestas); p.add(buttonEliminarFiltroArestas); p.add(agrupamento); frame.getContentPane().add(p, BorderLayout.NORTH); frame.setSize(900, 600); frame.setVisible(true); }
From source file:uk.co.moonsit.sockets.GraphClient.java
private Color getSeriesColor(int index) { if (index > 10) { index = index % 11;/*from www.ja va2 s . c om*/ } switch (index) { case 0: return Color.BLUE.brighter().brighter(); case 1: return Color.RED.brighter(); case 2: return Color.GREEN.darker(); case 3: return Color.CYAN.darker(); case 4: return Color.ORANGE.darker(); case 5: return Color.DARK_GRAY; case 6: return Color.MAGENTA; case 7: return Color.BLUE.darker().darker(); case 8: return Color.CYAN.darker().darker(); case 9: return Color.BLACK.brighter(); case 10: return Color.RED.darker(); } return Color.LIGHT_GRAY; }
From source file:net.sf.maltcms.common.charts.api.overlay.SelectionOverlay.java
private void drawEntity(Shape entity, Graphics2D g2, Color fill, ChartPanel chartPanel, boolean scale) { if (entity != null) { Shape savedClip = g2.getClip(); Rectangle2D dataArea = chartPanel.getScreenDataArea(); Color c = g2.getColor();// w w w . ja v a 2 s .c om Composite comp = g2.getComposite(); g2.clip(dataArea); g2.setColor(fill); AffineTransform originalTransform = g2.getTransform(); Shape transformed = entity; if (scale) { transformed = scaleAtOrigin(entity, hoverScaleX, hoverScaleY).createTransformedShape(entity); } transformed = getTranslateInstance( entity.getBounds2D().getCenterX() - transformed.getBounds2D().getCenterX(), entity.getBounds2D().getCenterY() - transformed.getBounds2D().getCenterY()) .createTransformedShape(transformed); g2.setComposite(getInstance(AlphaComposite.SRC_OVER, fillAlpha)); g2.fill(transformed); g2.setColor(Color.DARK_GRAY); g2.draw(transformed); g2.setComposite(comp); g2.setColor(c); g2.setClip(savedClip); } }
From source file:com.vgi.mafscaling.Rescale.java
private void createGraghPanel(JPanel dataPanel) { JFreeChart chart = ChartFactory.createScatterPlot(null, null, null, null, PlotOrientation.VERTICAL, false, true, false);// www . j a v a2s. c o m chart.setBorderVisible(true); mafChartPanel = new MafChartPanel(chart, this); GridBagConstraints gbl_chartPanel = new GridBagConstraints(); gbl_chartPanel.anchor = GridBagConstraints.PAGE_START; gbl_chartPanel.insets = insets0; gbl_chartPanel.fill = GridBagConstraints.BOTH; gbl_chartPanel.weightx = 1.0; gbl_chartPanel.weighty = 1.0; gbl_chartPanel.gridx = 0; gbl_chartPanel.gridy = 2; dataPanel.add(mafChartPanel.getChartPanel(), gbl_chartPanel); XYSplineRenderer lineRenderer = new XYSplineRenderer(3); lineRenderer.setUseFillPaint(true); lineRenderer.setBaseToolTipGenerator( new StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT, new DecimalFormat("0.00"), new DecimalFormat("0.00"))); Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, null, 0.0f); lineRenderer.setSeriesStroke(0, stroke); lineRenderer.setSeriesStroke(1, stroke); lineRenderer.setSeriesPaint(0, new Color(201, 0, 0)); lineRenderer.setSeriesPaint(1, new Color(0, 0, 255)); lineRenderer.setSeriesShape(0, ShapeUtilities.createDiamond((float) 2.5)); lineRenderer.setSeriesShape(1, ShapeUtilities.createUpTriangle((float) 2.5)); ValueAxis mafvDomain = new NumberAxis(XAxisName); ValueAxis mafgsRange = new NumberAxis(YAxisName); XYSeriesCollection lineDataset = new XYSeriesCollection(); lineDataset.addSeries(currMafData); lineDataset.addSeries(corrMafData); XYPlot plot = chart.getXYPlot(); plot.setRangePannable(true); plot.setDomainPannable(true); plot.setDomainGridlinePaint(Color.DARK_GRAY); plot.setRangeGridlinePaint(Color.DARK_GRAY); plot.setBackgroundPaint(new Color(224, 224, 224)); plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); plot.setDataset(0, lineDataset); plot.setRenderer(0, lineRenderer); plot.setDomainAxis(0, mafvDomain); plot.setRangeAxis(0, mafgsRange); plot.mapDatasetToDomainAxis(0, 0); plot.mapDatasetToRangeAxis(0, 0); LegendTitle legend = new LegendTitle(plot.getRenderer()); legend.setItemFont(new Font("Arial", 0, 10)); legend.setPosition(RectangleEdge.TOP); chart.addLegend(legend); }
From source file:de.codesourcery.jasm16.utils.ASTInspector.java
public ASTInspector() { defaultStyle = new SimpleAttributeSet(); errorStyle = createStyle(Color.RED); registerStyle = createStyle(Color.ORANGE); commentStyle = createStyle(Color.DARK_GRAY); instructionStyle = createStyle(Color.BLUE); labelStyle = createStyle(Color.GREEN); preProcessorStyle = createStyle(new Color(200, 200, 200)); }
From source file:lol.search.RankedStatsPage.java
private JPanel statsPanel() { JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY)); panel.setOpaque(false);//from w w w. j a v a 2 s . c om panel.setLayout(new FlowLayout()); panel.setPreferredSize(new Dimension(910, 464)); JPanel statsPanelTotals = new JPanel(); statsPanelTotals.setLayout(new BoxLayout(statsPanelTotals, BoxLayout.X_AXIS)); statsPanelTotals.setOpaque(false); //statsPanelTotals.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY)); //totals statsPanelTotals.setPreferredSize(new Dimension(910, 45)); totalJLabel(winsLabel, " W: ", Color.WHITE); winsLabel.setAlignmentX(Component.LEFT_ALIGNMENT); totalJLabel(totalWins, "" + this.wins, valueOrange); totalJLabel(lossesLabel, " L: ", Color.WHITE); totalJLabel(totalLosses, "" + this.losses, valueOrange); totalJLabel(winPercentLabel, " Win Ratio: ", Color.WHITE); totalJLabel(winPercent, winPercentage + "%", valueOrange); totalJLabel(totalGames, " Total Games Played: ", Color.WHITE); totalJLabel(this.totalGamesPlayed, String.valueOf(totalGamesInt), valueOrange); statsPanelTotals.add(winsLabel); statsPanelTotals.add(totalWins); statsPanelTotals.add(lossesLabel); statsPanelTotals.add(totalLosses); statsPanelTotals.add(winPercentLabel); statsPanelTotals.add(winPercent); statsPanelTotals.add(totalGames); statsPanelTotals.add(totalGamesPlayed); JPanel totalsAndAverages = new JPanel(); totalsAndAverages.setOpaque(false); totalsAndAverages.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY)); totalsAndAverages.setPreferredSize(new Dimension(910, 405)); totalsAndAverages.setLayout(new GridLayout()); JPanel leftSide = new JPanel(); leftSide.setOpaque(false); leftSide.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY)); JPanel leftSideHeader = new JPanel(); leftSideHeader.setOpaque(false); leftSideHeader.setLayout(new FlowLayout()); leftSideHeader.setPreferredSize(new Dimension(455, 35)); //leftSideHeader.setBorder(BorderFactory.createLineBorder(Color.CYAN)); totalJLabel(this.leftSideHeaderLabel, " Per Game Averages:", Color.WHITE); leftSideHeader.add(this.leftSideHeaderLabel); JPanel leftSideBody = new JPanel(); leftSideBody.setOpaque(false); leftSideBody.setLayout(new FlowLayout(FlowLayout.LEFT)); leftSideBody.setPreferredSize(new Dimension(250, 360)); //leftSideBody.setBorder(BorderFactory.createLineBorder(Color.RED)); JPanel avgKillsPanel = new JPanel(); avgKillsPanel.setOpaque(false); //avgKillsPanel.setBorder(BorderFactory.createLineBorder(Color.CYAN)); JPanel avgDeathsPanel = new JPanel(); avgDeathsPanel.setOpaque(false); JPanel avgAssistsPanel = new JPanel(); avgAssistsPanel.setOpaque(false); JPanel avgMinionsPanel = new JPanel(); avgMinionsPanel.setOpaque(false); JPanel avgDoubleKillsPanel = new JPanel(); avgDoubleKillsPanel.setOpaque(false); JPanel avgTripleKillsPanel = new JPanel(); avgTripleKillsPanel.setOpaque(false); JPanel avgQuadKillsPanel = new JPanel(); avgQuadKillsPanel.setOpaque(false); JPanel avgPentaKillsPanel = new JPanel(); avgPentaKillsPanel.setOpaque(false); totalJLabel(this.avgKillsLabel, " Avg. Kills: ", Color.WHITE); totalJLabel(this.avgDeathsLabel, " Avg. Deaths: ", Color.WHITE); totalJLabel(this.avgAssistsLabel, " Avg. Assists: ", Color.WHITE); totalJLabel(this.avgMinionKillsLabel, " Avg. Minion Kills: ", Color.WHITE); totalJLabel(this.avgDoubleKillsLabel, " Avg. Double Kills: ", Color.WHITE); totalJLabel(this.avgTripleKillsLabel, " Avg. Triple Kills: ", Color.WHITE); totalJLabel(this.avgQuadKillsLabel, " Avg. Quadra Kills: ", Color.WHITE); totalJLabel(this.avgPentaKillsLabel, " Avg. Penta Kills: ", Color.WHITE); double totalKills = 00000; double totalDeaths = 00000; double totalAssists = 00000; double totalMinions = 00000; double totalDoubleKills = 00000; double totalTripleKills = 00000; double totalQuadraKills = 00000; double totalPentaKills = 00000; double avgKills = 99999; double avgAssists = 99999; double avgDeaths = 99999; double avgMinions = 99999; double avgDoubleKills = 99999; double avgTripleKills = 99999; double avgQuadraKills = 99999; double avgPentaKills = 99999; try { double totalGamesPlayed = this.objChampRankedList.get(0).getJSONObject("stats") .getInt("totalSessionsPlayed"); //operations totalKills = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalChampionKills"); avgKills = totalKills / totalGamesPlayed; totalDeaths = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalDeathsPerSession"); avgDeaths = totalDeaths / totalGamesPlayed; totalAssists = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalAssists"); avgAssists = totalAssists / totalGamesPlayed; totalMinions = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalMinionKills"); avgMinions = totalMinions / totalGamesPlayed; totalDoubleKills = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalDoubleKills"); avgDoubleKills = totalDoubleKills / totalGamesPlayed; totalTripleKills = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalTripleKills"); avgTripleKills = totalTripleKills / totalGamesPlayed; totalQuadraKills = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalQuadraKills"); avgQuadraKills = totalQuadraKills / totalGamesPlayed; totalPentaKills = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalPentaKills"); avgPentaKills = totalPentaKills / totalGamesPlayed; } catch (JSONException ex) { Logger.getLogger(RankedStatsPage.class.getName()).log(Level.SEVERE, null, ex); } String avgKillsString = new DecimalFormat("##.##").format(avgKills); String avgDeathsString = new DecimalFormat("##.##").format(avgDeaths); String avgAssistsString = new DecimalFormat("##.##").format(avgAssists); String avgMinionsString = new DecimalFormat("##.##").format(avgMinions); String avgDoubleKillsString = new DecimalFormat("##.##").format(avgDoubleKills); String avgTripleKillsString = new DecimalFormat("##.##").format(avgTripleKills); String avgQuadraKillsString = new DecimalFormat("##.##").format(avgQuadraKills); String avgPentaKillsString = new DecimalFormat("##.##").format(avgPentaKills); totalJLabel(this.avgKillsLabelValue, avgKillsString, valueOrange); totalJLabel(this.avgDeathsLabelValue, avgDeathsString, valueOrange); totalJLabel(this.avgAssistsLabelValue, avgAssistsString, valueOrange); totalJLabel(this.avgMinionKillsLabelValue, avgMinionsString, valueOrange); totalJLabel(this.avgDoubleKillsLabelValue, avgDoubleKillsString, valueOrange); totalJLabel(this.avgTripleKillsLabelValue, avgTripleKillsString, valueOrange); totalJLabel(this.avgQuadKillsLabelValue, avgQuadraKillsString, valueOrange); totalJLabel(this.avgPentaKillsLabelValue, avgPentaKillsString, valueOrange); avgKillsPanel.add(avgKillsLabel); avgKillsPanel.add(avgKillsLabelValue); avgDeathsPanel.add(avgDeathsLabel); avgDeathsPanel.add(avgDeathsLabelValue); avgAssistsPanel.add(avgAssistsLabel); avgAssistsPanel.add(avgAssistsLabelValue); avgMinionsPanel.add(avgMinionKillsLabel); avgMinionsPanel.add(avgMinionKillsLabelValue); avgDoubleKillsPanel.add(avgDoubleKillsLabel); avgDoubleKillsPanel.add(avgDoubleKillsLabelValue); avgTripleKillsPanel.add(avgTripleKillsLabel); avgTripleKillsPanel.add(avgTripleKillsLabelValue); avgQuadKillsPanel.add(avgQuadKillsLabel); avgQuadKillsPanel.add(avgQuadKillsLabelValue); avgPentaKillsPanel.add(avgPentaKillsLabel); avgPentaKillsPanel.add(avgPentaKillsLabelValue); leftSideBody.add(avgKillsPanel); leftSideBody.add(avgDeathsPanel); leftSideBody.add(avgAssistsPanel); leftSideBody.add(avgMinionsPanel); leftSideBody.add(avgDoubleKillsPanel); leftSideBody.add(avgTripleKillsPanel); leftSideBody.add(avgQuadKillsPanel); leftSideBody.add(avgPentaKillsPanel); leftSide.add(leftSideHeader); leftSide.add(leftSideBody); JPanel rightSide = new JPanel(); /**/ rightSide.setOpaque(false); rightSide.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY)); JPanel rightSideHeader = new JPanel(); rightSideHeader.setOpaque(false); rightSideHeader.setLayout(new FlowLayout()); rightSideHeader.setPreferredSize(new Dimension(455, 35)); //rightSideHeader.setBorder(BorderFactory.createLineBorder(Color.MAGENTA)); totalJLabel(this.rightSideHeaderLabel, " Season Totals:", Color.WHITE); rightSideHeader.add(this.rightSideHeaderLabel); JPanel rightSideBody = new JPanel(); rightSideBody.setOpaque(false); rightSideBody.setLayout(new FlowLayout(FlowLayout.LEFT)); rightSideBody.setPreferredSize(new Dimension(270, 360)); //rightSideBody.setBorder(BorderFactory.createLineBorder(Color.MAGENTA)); JPanel totalKillsPanel = new JPanel(); totalKillsPanel.setOpaque(false); JPanel totalDeathsPanel = new JPanel(); totalDeathsPanel.setOpaque(false); JPanel totalAssistsPanel = new JPanel(); totalAssistsPanel.setOpaque(false); JPanel totalMinionsPanel = new JPanel(); totalMinionsPanel.setOpaque(false); JPanel totalDoubleKillsPanel = new JPanel(); totalDoubleKillsPanel.setOpaque(false); JPanel totalTripleKillsPanel = new JPanel(); totalTripleKillsPanel.setOpaque(false); JPanel totalQuadKillsPanel = new JPanel(); totalQuadKillsPanel.setOpaque(false); JPanel totalPentaKillsPanel = new JPanel(); totalPentaKillsPanel.setOpaque(false); totalJLabel(this.totalKillsLabel, " Total Kills: ", Color.WHITE); totalJLabel(this.totalKillsLabelValue, new DecimalFormat("#######").format(totalKills), valueOrange); totalJLabel(this.totalDeathsLabel, " Total Deaths: ", Color.WHITE); totalJLabel(this.totalDeathsLabelValue, new DecimalFormat("#######").format(totalDeaths), valueOrange); totalJLabel(this.totalAssistsLabel, " Total Assists: ", Color.WHITE); totalJLabel(this.totalAssistsLabelValue, new DecimalFormat("#######").format(totalAssists), valueOrange); totalJLabel(this.totalMinionsLabel, " Total Minion Kills: ", Color.WHITE); totalJLabel(this.totalMinionsLabelValue, new DecimalFormat("#######").format(totalMinions), valueOrange); totalJLabel(this.totalDoubleKillsLabel, " Total Double Kills: ", Color.WHITE); totalJLabel(this.totalDoubleKillsLabelValue, new DecimalFormat("#######").format(totalDoubleKills), valueOrange); totalJLabel(this.totalTripleKillsLabel, " Total Triple Kills: ", Color.WHITE); totalJLabel(this.totalTripleKillsLabelValue, new DecimalFormat("#######").format(totalTripleKills), valueOrange); totalJLabel(this.totalQuadKillsLabel, " Total Quadra Kills: ", Color.WHITE); totalJLabel(this.totalQuadKillsLabelValue, new DecimalFormat("#######").format(totalQuadraKills), valueOrange); totalJLabel(this.totalPentaKillsLabel, " Total Penta Kills: ", Color.WHITE); totalJLabel(this.totalPentaKillsLabelValue, new DecimalFormat("#######").format(totalPentaKills), valueOrange); totalKillsPanel.add(totalKillsLabel); totalKillsPanel.add(totalKillsLabelValue); totalDeathsPanel.add(totalDeathsLabel); totalDeathsPanel.add(totalDeathsLabelValue); totalAssistsPanel.add(totalAssistsLabel); totalAssistsPanel.add(totalAssistsLabelValue); totalMinionsPanel.add(totalMinionsLabel); totalMinionsPanel.add(totalMinionsLabelValue); totalDoubleKillsPanel.add(totalDoubleKillsLabel); totalDoubleKillsPanel.add(totalDoubleKillsLabelValue); totalTripleKillsPanel.add(totalTripleKillsLabel); totalTripleKillsPanel.add(totalTripleKillsLabelValue); totalQuadKillsPanel.add(totalQuadKillsLabel); totalQuadKillsPanel.add(totalQuadKillsLabelValue); totalPentaKillsPanel.add(totalPentaKillsLabel); totalPentaKillsPanel.add(totalPentaKillsLabelValue); rightSideBody.add(totalKillsPanel); rightSideBody.add(totalDeathsPanel); rightSideBody.add(totalAssistsPanel); rightSideBody.add(totalMinionsPanel); rightSideBody.add(totalDoubleKillsPanel); rightSideBody.add(totalTripleKillsPanel); rightSideBody.add(totalQuadKillsPanel); rightSideBody.add(totalPentaKillsPanel); //rightSideBody.setBorder(BorderFactory.createLineBorder(Color.RED)); rightSide.add(rightSideHeader); rightSide.add(rightSideBody); totalsAndAverages.add(rightSide); totalsAndAverages.add(leftSide); panel.add(statsPanelTotals); panel.add(totalsAndAverages); return panel; }