List of usage examples for java.awt Color LIGHT_GRAY
Color LIGHT_GRAY
To view the source code for java.awt Color LIGHT_GRAY.
Click Source Link
From source file:pe.egcc.eureka.app.view.RepoResumen.java
private Object crearImagen(List<Map<String, ?>> lista) { //datos del grfico String moneda = null;//from w w w . java2 s. c o m DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (Map<String, ?> map : lista) { double importe = Double.parseDouble(map.get("IMPORTE").toString()); moneda = map.get("MONENOMBRE").toString(); String accion = map.get("ACCION").toString(); dataset.addValue(importe, moneda, accion); } JFreeChart graficoBarras = ChartFactory.createBarChart("RESUMEN DE MOVIMIENTOS", //Ttulo de la grfica "TIPOS DE MOVIMIENTOS", //leyenda Eje horizontal "MILES DE " + moneda, //leyenda Eje vertical dataset, //datos PlotOrientation.VERTICAL, //orientacin true, //incluir leyendas true, //mostrar tooltips true); graficoBarras.setBackgroundPaint(Color.LIGHT_GRAY); CategoryPlot plot = (CategoryPlot) graficoBarras.getPlot(); plot.setBackgroundPaint(Color.CYAN); //fondo del grafico plot.setDomainGridlinesVisible(true);//lineas de rangos, visibles plot.setRangeGridlinePaint(Color.BLACK);//color de las lineas de rangos // Crear imagen BufferedImage imagen = graficoBarras.createBufferedImage(500, 300); return imagen; }
From source file:semgen.extraction.RadialGraph.Clusterer.java
public void setUpView() throws IOException { setTitle(SemGenTab.formatTabName(extractor.semsimmodel.getName())); layout = new AggregateLayout<String, Number>(new SemGenFRLayout<String, Number>(mygraph)); vv = new VisualizationViewer<String, Number>(layout); // this class will provide both label drawing and vertex shapes VertexLabelAsShapeRenderer<String, Number> vlasr = new VertexLabelAsShapeRenderer<String, Number>( vv.getRenderContext());//from ww w . ja v a2s . c o m // customize the render context vv.getRenderContext().setVertexLabelTransformer( // this chains together Transformers so that the html tags // are prepended to the toString method output new ChainedTransformer<String, String>( new Transformer[] { new ToStringLabeller<String>(), new Transformer<String, String>() { public String transform(String input) { return input; } } })); vv.getRenderContext().setVertexShapeTransformer(vlasr); vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.red)); vv.getRenderContext().setEdgeDrawPaintTransformer(new ConstantTransformer(Color.yellow)); vv.getRenderContext().setEdgeStrokeTransformer(new ConstantTransformer(new BasicStroke(2.5f))); // customize the renderer vv.getRenderer().setVertexLabelRenderer(vlasr); vv.setBackground(Color.white); // Tell the renderer to use our own customized color rendering vv.getRenderContext() .setVertexFillPaintTransformer(MapTransformer.<String, Paint>getInstance(vertexPaints)); vv.getRenderContext().setVertexDrawPaintTransformer(new Transformer<String, Paint>() { public Paint transform(String v) { if (vv.getPickedVertexState().isPicked(v)) { if (selectioncheckbox != null) { extractor.clusterpanel.remove(selectioncheckbox); } Set<DataStructure> dsuris = new HashSet<DataStructure>(); for (String dsname : vv.getPickedVertexState().getPicked()) { dsuris.add(extractor.semsimmodel.getDataStructure(dsname)); } Component[] clusters = extractor.clusterpanel.checkboxpanel.getComponents(); extractor.clusterpanel.checkboxpanel.removeAll(); for (int x = -1; x < clusters.length; x++) { if (x == -1 && selectioncheckbox == null) { selectioncheckbox = new ExtractorJCheckBox("Selected node(s)", dsuris); selectioncheckbox.addItemListener(extractor); extractor.clusterpanel.checkboxpanel.add(selectioncheckbox); } else if (x > -1) { extractor.clusterpanel.checkboxpanel.add(clusters[x]); } } refreshModulePanel(); return Color.cyan; } else { if (vv.getPickedVertexState().getPicked().isEmpty()) { if (selectioncheckbox != null) { extractor.clusterpanel.checkboxpanel.remove(selectioncheckbox); selectioncheckbox = null; } } refreshModulePanel(); return Color.BLACK; } } }); vv.getRenderContext().setEdgeDrawPaintTransformer(MapTransformer.<Number, Paint>getInstance(edgePaints)); vv.getRenderContext().setEdgeStrokeTransformer(new Transformer<Number, Stroke>() { protected final Stroke THIN = new BasicStroke(1); protected final Stroke THICK = new BasicStroke(2); public Stroke transform(Number e) { Paint c = edgePaints.get(e); if (c == Color.LIGHT_GRAY) return THIN; else return THICK; } }); // add restart button JButton scramble = new JButton("Shake"); scramble.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { Layout<String, Number> layout = vv.getGraphLayout(); layout.initialize(); Relaxer relaxer = vv.getModel().getRelaxer(); if (relaxer != null) { relaxer.stop(); relaxer.prerelax(); relaxer.relax(); } } }); DefaultModalGraphMouse<Object, Object> gm = new DefaultModalGraphMouse<Object, Object>(); vv.setGraphMouse(gm); groupVertices = new JToggleButton("Group Clusters"); // Create slider to adjust the number of edges to remove when clustering final JSlider edgeBetweennessSlider = new JSlider(JSlider.HORIZONTAL); edgeBetweennessSlider.setBackground(Color.WHITE); edgeBetweennessSlider.setPreferredSize(new Dimension(350, 50)); edgeBetweennessSlider.setPaintTicks(true); edgeBetweennessSlider.setMaximum(mygraph.getEdgeCount()); edgeBetweennessSlider.setMinimum(0); edgeBetweennessSlider.setValue(0); if (mygraph.getEdgeCount() > 10) { edgeBetweennessSlider.setMajorTickSpacing(mygraph.getEdgeCount() / 10); } else { edgeBetweennessSlider.setMajorTickSpacing(1); } edgeBetweennessSlider.setPaintLabels(true); edgeBetweennessSlider.setPaintTicks(true); // I also want the slider value to appear final JPanel eastControls = new JPanel(); eastControls.setOpaque(true); eastControls.setLayout(new BoxLayout(eastControls, BoxLayout.Y_AXIS)); eastControls.add(Box.createVerticalGlue()); eastControls.add(edgeBetweennessSlider); final String COMMANDSTRING = "Edges removed for clusters: "; final String eastSize = COMMANDSTRING + edgeBetweennessSlider.getValue(); final TitledBorder sliderBorder = BorderFactory.createTitledBorder(eastSize); eastControls.setBorder(sliderBorder); eastControls.add(Box.createVerticalGlue()); groupVertices.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { clusterAndRecolor(layout, edgeBetweennessSlider.getValue(), similarColors, e.getStateChange() == ItemEvent.SELECTED); vv.repaint(); } }); edgeBetweennessSlider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { JSlider source = (JSlider) e.getSource(); if (!source.getValueIsAdjusting()) { int numEdgesToRemove = source.getValue(); clusterAndRecolor(layout, numEdgesToRemove, similarColors, groupVertices.isSelected()); sliderBorder.setTitle(COMMANDSTRING + edgeBetweennessSlider.getValue()); eastControls.repaint(); vv.validate(); vv.repaint(); } } }); clusterAndRecolor(layout, 0, similarColors, groupVertices.isSelected()); clusterpanel = new JPanel(); clusterpanel.setLayout(new BoxLayout(clusterpanel, BoxLayout.Y_AXIS)); GraphZoomScrollPane gzsp = new GraphZoomScrollPane(vv); clusterpanel.add(gzsp); JPanel south = new JPanel(); JPanel grid = new JPanel(new GridLayout(2, 1)); grid.add(scramble); grid.add(groupVertices); south.add(grid); south.add(eastControls); JPanel p = new JPanel(); p.setBorder(BorderFactory.createTitledBorder("Mouse Mode")); p.add(gm.getModeComboBox()); south.add(p); clusterpanel.add(south); clusterpanel.add(Box.createGlue()); semscroller = new SemGenScrollPane(sempanel); splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, semscroller, clusterpanel); splitpane.setDividerLocation(initsempanelwidth); splitpane.setDividerLocation(initsempanelwidth + 10); this.add(splitpane); this.setPreferredSize(new Dimension(950, 800)); this.pack(); this.setLocationRelativeTo(null); this.setVisible(true); }
From source file:com.epiq.bitshark.ui.FrequencyDomainPanel.java
/** * Initialize the graph/* w w w . j a v a 2s .co m*/ */ private void initGraph() { this.series = new BasicSeries("FFT"); XYSeriesCollection dataset = new XYSeriesCollection(series); JFreeChart graph = ChartFactory.createXYLineChart(null, // title "", // no x-axis label "", // no y-axis label dataset, // data PlotOrientation.VERTICAL, false, // no legend false, // no tooltips false // no URLs ); graph.setBorderVisible(false); graph.setPadding(new RectangleInsets(-5, 0, 0, 0)); graph.setBackgroundPaint(null); graph.setBackgroundImageAlpha(0.0f); graph.setAntiAlias(true); plot = (XYPlot) graph.getPlot(); powerAxis = new PowerAxis(); plot.setRangeAxis(powerAxis); frequencyAxis = new FrequencyAxis(); frequencyAxis.setTickLabelInsets(new RectangleInsets(10, 0, 0, 0)); plot.setDomainAxis(frequencyAxis); XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(false); renderer.setBaseShapesFilled(true); renderer.setSeriesPaint(0, Common.EPIQ_GREEN); renderer.setSeriesStroke(0, new BasicStroke(1.0f)); } plot.setBackgroundAlpha(0.0f); plot.setBackgroundPaint(null); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setAxisOffset(new RectangleInsets(0, 0, 0, 0)); // X-axis setup plot.getDomainAxis().setAutoRange(false); plot.getDomainAxis().setVisible(true); plot.getDomainAxis().setRange(0, FMCUartClient.BLOCK_SIZE - 1); plot.setDomainCrosshairVisible(false); plot.setDomainCrosshairPaint(new Color(46, 46, 46)); // Y-axis setup plot.getRangeAxis().setAutoRange(false); plot.getRangeAxis().setVisible(true); plot.getRangeAxis().setRange(-50, 70); plot.setRangeCrosshairVisible(false); markerAnnotation.setVisible(false); plot.addAnnotation(markerAnnotation); plot.addAnnotation(markerTextAnnotation); this.markerTitle.setFont(new Font("Tahoma", Font.BOLD, 12)); this.markerTitle.setFrame(new BlockBorder(new Color(46, 46, 46))); this.markerTitle.setBackgroundPaint(new Color(200, 200, 255, 100)); this.markerTitle.setText(""); this.markerTitle.setPadding(5, 15, 5, 15); this.markerTitle.setExpandToFitSpace(false); this.markerTitle.setBounds(new Rectangle2D.Double(0, 0, 100, 30)); chartPanel = new ChartPanel(graph, false); chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE); chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE); chartPanel.setMinimumDrawWidth(0); chartPanel.setMinimumDrawHeight(0); chartPanel.setMouseZoomable(true); chartPanel.setOpaque(false); chartPanel.addChartMouseListener(new ChartMouseListener() { @Override public void chartMouseClicked(ChartMouseEvent event) { markerLocked = !markerLocked; } @Override public void chartMouseMoved(ChartMouseEvent event) { updateMouseMarker(event); } }); chartPanel.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { if (!markerLocked) { markerAnnotation.setVisible(false); plot.setDomainCrosshairVisible(false); markerTitle.setVisible(false); markerTitle.setText(""); } } }); chartPanel.addMouseWheelListener(new MouseWheelListener() { @Override public void mouseWheelMoved(MouseWheelEvent e) { int clicks = e.getWheelRotation(); plot.getRangeAxis().setUpperBound(plot.getRangeAxis().getUpperBound() + clicks); plot.getRangeAxis().setLowerBound(plot.getRangeAxis().getLowerBound() + clicks); } }); }
From source file:gg.view.overview.IncomeExpensesTopComponent.java
/** Displays the total income vs expenses for the current month */ public void displayData() { log.info("Income vs Expenses graph computed and displayed"); // Display hourglass cursor Utilities.changeCursorWaitStatus(true); // Create a dataset (the dataset will contain the plotted values) DefaultCategoryDataset dataset = new DefaultCategoryDataset(); // Create an empty chart JFreeChart chart = ChartFactory.createBarChart("", // chart title "", // x axis label NbBundle.getMessage(IncomeExpensesTopComponent.class, "IncomeExpensesTopComponent.Amount"), // y axis label dataset, // data displayed in the chart PlotOrientation.VERTICAL, false, // include legend true, // tooltips false // urls );/*from ww w. j a va 2 s . c o m*/ // Update the chart color chart.setBackgroundPaint(jPanelIncomeExpenses.getBackground()); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); // Set the orientation of the categories on the domain axis (X axis) CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD); // Set the range axis (Y axis) to display integers only NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // Set the bar renderer BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); renderer.setMaximumBarWidth(0.1); GradientPaint gradientPaint = new GradientPaint(0.0f, 0.0f, new Color(49, 106, 196), 0.0f, 0.0f, Color.LIGHT_GRAY); renderer.setSeriesPaint(0, gradientPaint); // Create a period for the current month LocalDate today = new LocalDate(); Period currentMonth = new Period(Periods.getAdjustedStartDate(today, PeriodType.MONTH), Periods.getAdjustedEndDate(today, PeriodType.MONTH), PeriodType.MONTH); // Fill the dataset List<Currency> currencies = Wallet.getInstance().getActiveCurrencies(); for (Currency currency : currencies) { // Filter on the currency and on the current month SearchCriteria searchCriteria = new SearchCriteria(currency, null, currentMonth, null, null, null, false); // Get income BigDecimal currencyIncome = Datamodel.getIncome(searchCriteria); currencyIncome = currencyIncome.setScale(2, RoundingMode.HALF_EVEN); // Get expenses BigDecimal currencyExpenses = Datamodel.getExpenses(searchCriteria).abs(); currencyExpenses = currencyExpenses.setScale(2, RoundingMode.HALF_EVEN); // Plot income and expenses for the current month and for the current currency on the chart dataset.addValue(currencyIncome, currency.getName(), NbBundle.getMessage(IncomeExpensesTopComponent.class, "IncomeExpensesTopComponent.Income", new Object[] { currency })); dataset.addValue(currencyExpenses, currency.getName(), NbBundle.getMessage(IncomeExpensesTopComponent.class, "IncomeExpensesTopComponent.Expenses", new Object[] { currency })); } // Create the chart panel that contains the chart ChartPanel chartPanel = new ChartPanel(chart); // Display the chart jPanelIncomeExpenses.removeAll(); jPanelIncomeExpenses.add(chartPanel, BorderLayout.CENTER); // Display the normal cursor Utilities.changeCursorWaitStatus(false); }
From source file:gov.nih.nci.caintegrator.common.Cai2Util.java
/** * Used by classes to retrieve a color based on a number from a ten color palette. * (1-10) are colors and anything else returns black. * @param colorNumber - number to use.//from w w w . j av a 2 s. c o m * @return - Color object for that number. */ public static Color getBasicColor(int colorNumber) { switch (colorNumber) { case 1: return Color.GREEN; case 2: return Color.BLUE; case 3: return Color.RED; case 4: return Color.CYAN; case 5: return Color.DARK_GRAY; case 6: return Color.YELLOW; case 7: return Color.LIGHT_GRAY; case 8: return Color.MAGENTA; case 9: return Color.ORANGE; case 10: return Color.PINK; default: return Color.BLACK; } }
From source file:com.game.ui.views.CharacterEditor.java
/** * This method draws up the gui on the panel. *///from w w w. j av a 2 s. c om public void doGui() { JPanel outerPane = new JPanel(); outerPane.setLayout(new GridBagLayout()); // setLayout(new GridBagLayout()); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JLabel noteLbl = new JLabel(lblContent); noteLbl.setAlignmentX(0); GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.WEST; c.fill = GridBagConstraints.NONE; c.insets = new Insets(5, 5, 5, 5); c.gridwidth = 4; c.gridy = 0; c.gridx = 0; outerPane.add(noteLbl, c); System.out.println(c.gridy); c.gridy++; System.out.println(c.gridy); c.gridx = 0; c.gridwidth = 1; comboBox = new JComboBox(model); comboBox.setSelectedIndex(-1); comboBox.setMaximumSize(new Dimension(100, 30)); comboBox.setAlignmentX(0); comboBox.setActionCommand("dropDown"); comboBox.addActionListener(this); outerPane.add(comboBox, c); c.gridy++; JLabel nameLbl = new JLabel("Name : "); outerPane.add(nameLbl, c); c.gridx++; name = new JTextField(); name.setColumns(20); outerPane.add(name, c); c.gridx = 0; c.gridy++; JLabel imageLbl = new JLabel("Image Path : "); outerPane.add(imageLbl, c); c.gridx++; imgPath = new JTextField(); imgPath.setColumns(20); outerPane.add(imgPath, c); c.gridx = 0; c.gridy++; JLabel hitPtsLbl = new JLabel("Hit Points : "); outerPane.add(hitPtsLbl, c); c.gridx++; hitPoints = new JTextField(); hitPoints.setColumns(20); outerPane.add(hitPoints, c); c.gridx = 0; c.gridy++; JLabel lvl = new JLabel("Level : "); outerPane.add(lvl, c); c.gridx++; level = new JTextField(); level.setColumns(20); /*if(!isEnemy){ level.setText("1"); level.setEnabled(false); }*/ outerPane.add(level, c); c.gridx = 0; c.gridy++; JLabel mlWpn = new JLabel("Melee Weapon : "); outerPane.add(mlWpn, c); c.gridx++; model = new DefaultComboBoxModel(); LinkedList<String> meleeWpnList = new LinkedList<String>(); LinkedList<String> rngdWpnList = new LinkedList<String>(); for (Item item : GameBean.weaponDetails) { Weapon wpn = (Weapon) item; if (wpn.getWeaponType().equalsIgnoreCase(Configuration.weaponTypes[0])) { meleeWpnList.add(wpn.getName()); } else { rngdWpnList.add(wpn.getName()); } weaponMap.put(wpn.getName(), wpn); } meleeWeapon = new JComboBox(new DefaultComboBoxModel(meleeWpnList.toArray())); meleeWeapon.setSelectedIndex(-1); meleeWeapon.setMaximumSize(new Dimension(100, 30)); outerPane.add(meleeWeapon, c); c.gridx++; JLabel rngdWpn = new JLabel("Ranged Weapon : "); outerPane.add(rngdWpn, c); c.gridx++; rangedWeapon = new JComboBox(new DefaultComboBoxModel(rngdWpnList.toArray())); rangedWeapon.setSelectedIndex(-1); rangedWeapon.setMaximumSize(new Dimension(100, 30)); outerPane.add(rangedWeapon, c); c.gridy++; c.gridx = 0; JLabel armourLbl = new JLabel("Armour : "); outerPane.add(armourLbl, c); c.gridx++; LinkedList<String> armourList = new LinkedList<String>(); LinkedList<String> shildList = new LinkedList<String>(); for (Item item : GameBean.armourDetails) { Armour temp = (Armour) item; if (temp.getArmourType() != null) { if (temp.getArmourType().equalsIgnoreCase(Configuration.armourTypes[1])) { armourList.add(temp.getName()); } else { shildList.add(temp.getName()); } } else { armourList.add(temp.getName()); // else if(temp.getArmourType().equalsIgnoreCase(Configuration.armourTypes[2])) shildList.add(temp.getName()); } armorMap.put(temp.getName(), temp); } armour = new JComboBox(new DefaultComboBoxModel(armourList.toArray())); armour.setSelectedIndex(-1); armour.setMaximumSize(new Dimension(100, 30)); outerPane.add(armour, c); c.gridx++; JLabel shieldLbl = new JLabel("Shield : "); outerPane.add(shieldLbl, c); c.gridx++; shield = new JComboBox(new DefaultComboBoxModel(shildList.toArray())); shield.setSelectedIndex(-1); shield.setMaximumSize(new Dimension(100, 30)); outerPane.add(shield, c); ta = new JTextArea(10, 50); ta.setRows(40); ta.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY)); JScrollPane scrollPane = new JScrollPane(ta); scrollPane.setPreferredSize(new Dimension(600, 250)); c.gridx = 0; c.gridy++; c.fill = GridBagConstraints.BOTH; c.gridwidth = 4; c.gridheight = 4; c.weightx = .5; c.weighty = 1; outerPane.add(scrollPane, c); c.gridy += 4; c.gridx = 0; c.weightx = 0; c.weighty = 0; c.fill = GridBagConstraints.NONE; c.gridheight = 1; c.gridwidth = 1; JButton generate = new JButton("Generate"); JButton submit = new JButton("Submit"); outerPane.add(generate, c); submit.addActionListener(this); generate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { ta.setText(""); HashSet<Integer> set = new HashSet<Integer>(); int strength = getUniqueVal(set); int constitution = getUniqueVal(set); int dext = getUniqueVal(set); int intel = getUniqueVal(set); int charisma = getUniqueVal(set); int wisdom = getUniqueVal(set); if (character == null) { builder = new CharacterBuilder(isEnemy); } else { builder = new CharacterBuilder(character); } builder.setStrength(strength); builder.setConstitution(constitution); builder.setDexterity(dext); builder.setIntelligence(intel); builder.setCharisma(charisma); builder.setWisdom(wisdom); int strModifier = GameUtils.calculateAbilityModifier(strength); int conModifier = GameUtils.calculateAbilityModifier(constitution); int dexModifier = GameUtils.calculateAbilityModifier(dext); int wisModifier = GameUtils.calculateAbilityModifier(wisdom); int intModifier = GameUtils.calculateAbilityModifier(intel); int chaModifier = GameUtils.calculateAbilityModifier(charisma); builder.setStrengthModifier(strModifier); builder.setConstitutionModifier(conModifier); builder.setCharismaModifier(chaModifier); builder.setWisdomModifier(wisModifier); builder.setIntelligenceModifier(intModifier); builder.setDexterityModifier(dexModifier); String type = null; if (constitution < strength && constitution > dext) { type = "Bully"; builder.setType("Bully"); } else if (dext > constitution && constitution > strength) { builder.setType("Nimble"); type = "Nimble"; } else { builder.setType("Tank"); type = "Tank"; } ta.append("Strength : " + strength); ta.append("\nDexterity : " + dexModifier); ta.append("\nConstitution : " + constitution); ta.append("\nIntelligence : " + intel); ta.append("\nCharisma: " + charisma); ta.append("\nWisdom : " + wisdom); ta.append("\nType :" + type); ta.append("\nStrength Modifier :" + strModifier); ta.append("\nConstitution Modifier :" + conModifier); ta.append("\nDexterity Modifier :" + dexModifier); generated = true; if (character != null) { character = builder.build(); } } }); c.gridx++; outerPane.add(submit, c); validationMess = new JLabel(); validationMess.setForeground(Color.red); // validationMess.setVisible(false); c.gridy++; c.gridx = 0; c.gridwidth = 4; outerPane.add(validationMess, c); JScrollPane outerScrollPane = new JScrollPane(outerPane); setLayout(new BorderLayout()); add(outerScrollPane, BorderLayout.CENTER); }
From source file:wef.articulab.view.ui.CombinedBNXYPlot.java
private XYPlot createPlot(ChartContainer chartContainer) { createDataset(chartContainer);/*from w w w . j a v a2 s . c o m*/ chartContainer.target = new IntervalMarker(14, 16); chartContainer.target.setLabel("Activation Threshold"); chartContainer.target.setLabelFont(new Font("SansSerif", Font.ITALIC, 11)); chartContainer.target.setLabelAnchor(RectangleAnchor.LEFT); chartContainer.target.setLabelTextAnchor(TextAnchor.CENTER_LEFT); chartContainer.target.setPaint(new Color(222, 222, 255, 128)); XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false); BasicStroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); for (int i = 0; i < chartContainer.series.length - 1; i++) { renderer.setSeriesStroke(i, stroke); } renderer.setSeriesStroke(chartContainer.series.length - 1, new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, new float[] { 10.0f }, 0.0f)); NumberAxis rangeAxis = new NumberAxis("Activation"); NumberAxis domainAxis = new NumberAxis("Time"); XYPlot plot = new XYPlot(chartContainer.dataset, domainAxis, rangeAxis, renderer); plot.addRangeMarker(chartContainer.target, Layer.BACKGROUND); plot.setRenderer(renderer); plot.setDomainGridlinePaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); plot.setRangeGridlinesVisible(true); plot.setBackgroundPaint(Color.LIGHT_GRAY); chartContainer.plot = plot; return plot; }
From source file:de.codesourcery.jasm16.ide.ui.views.WorkspaceExplorer.java
private JPanel createPanel() { treeModel = createTreeModel();/*from ww w. ja va 2 s. com*/ tree.setModel(treeModel); setColors(tree); tree.setRootVisible(false); // for (int i = 0; i < tree.getRowCount(); i++) { // tree.expandRow(i); // } tree.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_DELETE) { final WorkspaceTreeNode selection = getSelectedNode(); if (selection != null) { deleteResource(selection); } } else if (e.getKeyCode() == KeyEvent.VK_F5) { refreshWorkspace(null); } } }); tree.addMouseListener(new MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) { final TreePath path = tree.getPathForLocation(e.getX(), e.getY()); if (path != null) { final WorkspaceTreeNode selected = (WorkspaceTreeNode) path.getLastPathComponent(); final IAssemblyProject project = getProject(selected); try { if (project != null) { onTreeNodeLeftClick(project, selected); } else { System.err.println("Unable to locate project for " + selected); } } catch (IOException e1) { LOG.error("mouseClicked(): Internal error", e1); } } } } }); final TreeSelectionListener selectionListener = new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { } }; tree.getSelectionModel().addTreeSelectionListener(selectionListener); tree.setCellRenderer(new DefaultTreeCellRenderer() { public Color getTextSelectionColor() { return Color.GREEN; }; public java.awt.Color getTextNonSelectionColor() { return Color.GREEN; }; public Color getBackgroundSelectionColor() { return Color.BLACK; }; public Color getBackgroundNonSelectionColor() { return Color.BLACK; }; public java.awt.Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { java.awt.Component result = super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); String label = value.toString(); Color color = getTextColor(); if (value instanceof WorkspaceTreeNode) { if (value instanceof ProjectNode) { final ProjectNode projectNode = (ProjectNode) value; final IAssemblyProject project = projectNode.getValue(); label = project.getName(); if (project.isClosed()) { color = Color.LIGHT_GRAY; } else { if (projectNode.hasCompilationErrors()) { color = Color.RED; } } } else if (value instanceof FileNode) { FileNode fn = (FileNode) value; label = fn.getValue().getName(); switch (fn.type) { case DIRECTORY: if (fn.hasCompilationErrors()) { color = Color.RED; } break; case OBJECT_FILE: label = "[O] " + label; break; case EXECUTABLE: label = "[E] " + label; break; case SOURCE_CODE: label = "[S] " + label; if (fn.hasCompilationErrors()) { color = Color.RED; } break; default: // ok } } } setForeground(color); setText(label); return result; }; }); setupPopupMenu(); final JScrollPane pane = new JScrollPane(tree); setColors(pane); final JPanel result = new JPanel(); result.setLayout(new GridBagLayout()); GridBagConstraints cnstrs = constraints(0, 0, true, true, GridBagConstraints.BOTH); setColors(result); result.add(pane, cnstrs); return result; }
From source file:temp1.JFrame1.java
static void comp(int[] k1, int[] k2, int[] k3, int[] k4, int length1, int i, int eve1, int eve2, int eve3, JFreeChart jfreechart) {//www . j a va 2 s . c o m jfreechart1 = jfreechart; int j, l; length2 = length1; time1 = i; if (i == 5) { if (jFormattedTextField1.getValue() != null) fre = Integer.parseInt(jFormattedTextField1.getText()); if (jFormattedTextField2.getValue() != null) calo = Integer.parseInt(jFormattedTextField2.getText()); } if (((k1[i + 1] - k1[i + 2]) <= 15) && ((k1[i + 1] - k1[i + 2]) >= -15) && ((k1[i + 2] - k1[i + 3]) <= 15) && ((k1[i + 2] - k1[i + 3]) >= -15) && ((k1[i + 3] - k1[i + 4]) <= 15) && ((k1[i + 3] - k1[i + 4]) >= -15) && ((k1[i + 4] - k1[i + 5]) <= 15) && ((k1[i + 4] - k1[i + 5]) >= -15)) eve1 = ((((k1[i + 1] + k1[i + 2] + k1[i + 3] + k1[i + 4] + k1[i + 5]) / 5) - eve1) * 2 / 3) + eve1; if (((k2[i + 1] - k2[i + 2]) <= 15) && ((k2[i + 1] - k2[i + 2]) >= -15) && ((k2[i + 2] - k2[i + 3]) <= 15) && ((k2[i + 2] - k2[i + 3]) >= -15) && ((k2[i + 3] - k2[i + 4]) <= 15) && ((k2[i + 3] - k2[i + 4]) >= -15) && ((k2[i + 4] - k2[i + 5]) <= 15) && ((k2[i + 4] - k2[i + 5]) >= -15)) eve2 = ((((k2[i + 1] + k2[i + 2] + k2[i + 3] + k2[i + 4] + k2[i + 5]) / 5) - eve2) * 2 / 3) + eve2; if (((k3[i + 1] - k3[i + 2]) <= 15) && ((k3[i + 1] - k3[i + 2]) >= -15) && ((k3[i + 2] - k3[i + 3]) <= 15) && ((k3[i + 2] - k3[i + 3]) >= -15) && ((k3[i + 3] - k3[i + 4]) <= 15) && ((k3[i + 3] - k3[i + 4]) >= -15) && ((k3[i + 4] - k3[i + 5]) <= 15) && ((k3[i + 4] - k3[i + 5]) >= -15)) eve3 = ((((k3[i + 1] + k3[i + 2] + k3[i + 3] + k3[i + 4] + k3[i + 5]) / 5) - eve3) * 2 / 3) + eve3; if (k1[i] - eve1 > 35 && q1 == true) { t1 = k1[i]; q1 = false; q2 = true; } if (q2 == true && k1[i] >= t1) { t1 = k1[i]; } if (q2 == true && k1[i] < t1) { t1 = k1[i]; l1 = i - 1; j = l1; q2 = false; while (((k1[j + 1] - k1[j + 2]) >= 5) || ((k1[j + 1] - k1[j + 2]) <= -5) || ((k1[j + 2] - k1[j + 3]) >= 5) || ((k1[j + 2] - k1[j + 3]) <= -5) || ((k1[j + 3] - k1[j + 4]) >= 5) || ((k1[j + 3] - k1[j + 4]) <= -5) || ((k1[j + 4] - k1[j + 5]) >= 5) || ((k1[j + 4] - k1[j + 5]) <= -5)) j--; sta11 = j + 5; q3 = true; } if (q3 == true && k1[i] <= t1) { t1 = k1[i]; } if (q3 == true && k1[i] > t1) { m1 = i - 1; q4 = true; q3 = false; } if (((k1[i + 5] - k1[i + 4]) >= -5) && ((k1[i + 5] - k1[i + 4]) <= 5) && ((k1[i + 4] - k1[i + 3]) >= -5) && ((k1[i + 4] - k1[i + 3]) <= 5) && ((k1[i + 3] - k1[i + 2]) >= -5) && ((k1[i + 3] - k1[i + 2]) <= 5) && ((k1[i + 2] - k1[i + 1]) >= -5) && ((k1[i + 2] - k1[i + 1]) <= 5) && q4 == true) { end11 = i; p1 = true; q4 = false; q1 = true; } if (k3[i] - eve3 > 35 && e1 == true) { t3 = k3[i]; e1 = false; e2 = true; } if (e2 == true && k3[i] >= t3) { t3 = k3[i]; } if (e2 == true && k3[i] < t3) { t3 = k1[i]; l3 = i - 1; j = l3; e2 = false; while (((k2[j + 1] - k2[j + 2]) >= 5) || ((k2[j + 1] - k2[j + 2]) <= -5) || ((k2[j + 2] - k2[j + 3]) >= 5) || ((k2[j + 2] - k2[j + 3]) <= -5) || ((k2[j + 3] - k2[j + 4]) >= 5) || ((k2[j + 3] - k2[j + 4]) <= -5) || ((k2[j + 4] - k2[j + 5]) >= 5) || ((k2[j + 4] - k2[j + 5]) <= -5)) j--; sta33 = j + 5; e3 = true; } if (e3 == true && k3[i] <= t3) { t3 = k3[i]; } if (e3 == true && k3[i] > t3) { t3 = k3[i]; e4 = true; e3 = false; } if (e4 == true && k3[i] >= t3) t3 = k3[i]; if (e4 == true && k3[i] < t3) { m3 = i - 1; e4 = false; e5 = true; } if (((k3[i + 5] - k3[i + 4]) >= -5) && ((k3[i + 5] - k3[i + 4]) <= 5) && ((k3[i + 4] - k3[i + 3]) >= -5) && ((k3[i + 4] - k3[i + 3]) <= 5) && ((k3[i + 3] - k3[i + 2]) >= -5) && ((k3[i + 3] - k3[i + 2]) <= 5) && ((k3[i + 2] - k3[i + 1]) >= -5) && ((k3[i + 2] - k3[i + 1]) <= 5) && e5 == true) { end33 = i; p2 = true; e5 = false; e1 = true; } if (k2[i] - eve2 > 35 && w1 == true) { t2 = k1[i]; w1 = false; w2 = true; } if (w2 == true && k2[i] >= t2) { t2 = k2[i]; } if (w2 == true && k2[i] < t2) { t2 = k1[i]; l2 = i - 1; j = l2; w2 = false; while (((k2[j + 1] - k2[j + 2]) >= 5) || ((k2[j + 1] - k2[j + 2]) <= -5) || ((k2[j + 2] - k2[j + 3]) >= 5) || ((k2[j + 2] - k2[j + 3]) <= -5) || ((k2[j + 3] - k2[j + 4]) >= 5) || ((k2[j + 3] - k2[j + 4]) <= -5) || ((k2[j + 4] - k2[j + 5]) >= 5) || ((k2[j + 4] - k2[j + 5]) <= -5)) j--; sta22 = j + 5; w3 = true; } if (w3 == true && k2[i] <= t2) { t2 = k2[i]; } if (w3 == true && k2[i] > t2) { m2 = i - 1; w4 = true; w3 = false; } if (((k2[i + 5] - k2[i + 4]) >= -5) && ((k2[i + 5] - k2[i + 4]) <= 5) && ((k2[i + 4] - k2[i + 3]) >= -5) && ((k2[i + 4] - k2[i + 3]) <= 5) && ((k2[i + 3] - k2[i + 2]) >= -5) && ((k2[i + 3] - k2[i + 2]) <= 5) && ((k2[i + 2] - k2[i + 1]) >= -5) && ((k2[i + 2] - k2[i + 1]) <= 5) && w4 == true) { end22 = i; p3 = true; w4 = false; w1 = true; } if (p1 && p2 && p3) { p1 = false; p2 = false; p3 = false; if (fre == -1 && calo == -1) { System.out.println(k); DefaultTableModel tableMode2 = (DefaultTableModel) jTable1.getModel(); tableMode2.addRow(new Object[] { k, ":" + sta11 + "-" + ":" + end11, ":" + sta22 + "-" + ":" + end22, ":" + sta33 + "-" + ":" + end33, "", " " }); jTextPane3.setText(String.valueOf(k)); k++; } if (fre != -1 && calo == -1) { DefaultTableModel tableMode2 = (DefaultTableModel) jTable1.getModel(); double t = (double) ((m1 - l1 + m2 - l2 + m3 - l3) / 3 * fre); tableMode2.addRow(new Object[] { k, ":" + sta11 + "-" + ":" + end11, ":" + sta22 + "-" + ":" + end22, ":" + sta33 + "-" + ":" + end33, df.format(t), " " }); jTextPane3.setText(String.valueOf(k)); jTextField1.setText( String.valueOf(df.format((double) k / (((double) i * (double) fre / 3600) / 1000)))); k++; } if (fre != -1 && calo != -1) { DefaultTableModel tableMode2 = (DefaultTableModel) jTable1.getModel(); double t = (double) ((m1 - l1 + m2 - l2 + m3 - l3) / 3 * fre); double d = ((calo / t) * 1000) * 3.6; tableMode2.addRow(new Object[] { k, "" + sta11 + "-" + "" + end11, "" + sta22 + "-" + "" + end22, "" + sta33 + "-" + "" + end33, df.format(t), df.format(d) }); jTextPane3.setText(String.valueOf(k)); jTextField1.setText( String.valueOf(df.format((double) k / (((double) i * (double) fre / 3600) / 1000)))); k++; } } jProgressBar1.setBackground(Color.LIGHT_GRAY); jProgressBar1.setForeground(Color.blue); jProgressBar1.setValue((int) (i * 100 / (length2 - 5))); }
From source file:org.rdv.viz.image.HighResImageViz.java
private void initImageSelectorPanel() { imageSelectorPanel = new ImageSelectorPanel(this); imageSelectorPanel.setBackground(Color.LIGHT_GRAY); imageSelectorPanel.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent pce) { }//w ww .j a va2 s. c o m }); panel.add(imageSelectorPanel, BorderLayout.SOUTH); }