List of usage examples for java.awt Color getColor
public static Color getColor(String nm)
From source file:Main.java
public static void main(String[] args) { System.setProperty("myColor", "0XFFFFFF"); Color myColor = Color.getColor("myColor"); System.out.println(myColor);//from ww w .ja va 2s .co m }
From source file:com.springapp.mvc.mappers.VariantRowMapper.java
@Override public Variant mapRow(ResultSet resultSet, int rowNum) throws SQLException { Variant variant = new Variant(); variant.setCode(resultSet.getInt("code")); variant.setColor(Color.getColor(resultSet.getString("color"))); variant.setSize(resultSet.getInt("size")); return variant; }
From source file:com.milkdairy.collectionsmodule.CollectionsUpdateFormJPanel.java
public void init() { this.setLayout(null); System.setProperty("collectionsStoredFormColor", this.color); this.setBackground(Color.getColor("collectionsStoredFormColor")); this.formerIDL = this.addComponent(formerIDL, milkManagementSystemService.xPoint, milkManagementSystemService.yPoint, milkManagementSystemService.lblWidth, milkManagementSystemService.lblHeight); this.formerIDL.setText("Former ID"); formerIDTF = this.addComponent(formerIDTF, milkManagementSystemService.xPoint + milkManagementSystemService.lblWidth + 20, milkManagementSystemService.yPoint, milkManagementSystemService.tfWidth, milkManagementSystemService.tflHeight); formerIDTF.setEditable(false);//w w w . j av a 2s . com this.formerIDErrorL = this.addComponent(formerIDErrorL, milkManagementSystemService.xPoint + milkManagementSystemService.lblWidth + milkManagementSystemService.tfWidth + 40, milkManagementSystemService.yPoint, milkManagementSystemService.lblWidth, milkManagementSystemService.lblHeight); this.formerIDErrorL.setForeground(Color.RED); this.formerNameL = this.addComponent(formerNameL, milkManagementSystemService.xPoint, milkManagementSystemService.yPoint + 40, milkManagementSystemService.lblWidth, milkManagementSystemService.lblHeight); this.formerNameL.setText("Former Name"); formerNameTF = this.addComponent(formerNameTF, milkManagementSystemService.xPoint + milkManagementSystemService.lblWidth + 20, milkManagementSystemService.yPoint + 40, milkManagementSystemService.tfWidth, milkManagementSystemService.tflHeight); formerNameTF.setEditable(false); this.formerNameErrorL = this.addComponent(formerNameErrorL, milkManagementSystemService.xPoint + milkManagementSystemService.lblWidth + milkManagementSystemService.tfWidth + 40, milkManagementSystemService.yPoint + 40, milkManagementSystemService.lblWidth, milkManagementSystemService.lblHeight); this.formerNameErrorL.setForeground(Color.RED); this.milkPadL = this.addComponent(milkPadL, milkManagementSystemService.xPoint, milkManagementSystemService.yPoint + 80, milkManagementSystemService.lblWidth, milkManagementSystemService.lblHeight); this.milkPadL.setText("Milk Pad Value"); milkPadTF = this.addComponent(milkPadTF, milkManagementSystemService.xPoint + milkManagementSystemService.lblWidth + 20, milkManagementSystemService.yPoint + 80, milkManagementSystemService.tfWidth, milkManagementSystemService.tflHeight); this.milkPadErrorL = this.addComponent(milkPadErrorL, milkManagementSystemService.xPoint + milkManagementSystemService.lblWidth + milkManagementSystemService.tfWidth + 40, milkManagementSystemService.yPoint + 80, milkManagementSystemService.lblWidth, milkManagementSystemService.lblHeight); this.milkPadErrorL.setForeground(Color.RED); this.milkValueL = this.addComponent(milkValueL, milkManagementSystemService.xPoint, milkManagementSystemService.yPoint + 120, milkManagementSystemService.lblWidth, milkManagementSystemService.lblHeight); this.milkValueL.setText("Milk Quantity"); milkValueTF = this.addComponent(milkValueTF, milkManagementSystemService.xPoint + milkManagementSystemService.lblWidth + 20, milkManagementSystemService.yPoint + 120, milkManagementSystemService.tfWidth, milkManagementSystemService.tflHeight); this.milkValueErrorL = this.addComponent(milkValueErrorL, milkManagementSystemService.xPoint + milkManagementSystemService.lblWidth + milkManagementSystemService.tfWidth + 40, milkManagementSystemService.yPoint + 120, milkManagementSystemService.lblWidth, milkManagementSystemService.lblHeight); this.milkValueErrorL.setForeground(Color.RED); this.milkPriceL = this.addComponent(milkPriceL, milkManagementSystemService.xPoint, milkManagementSystemService.yPoint + 160, milkManagementSystemService.lblWidth, milkManagementSystemService.lblHeight); this.milkPriceL.setText("Milk Price"); milkPriceTF = this.addComponent(milkPriceTF, milkManagementSystemService.xPoint + milkManagementSystemService.lblWidth + 20, milkManagementSystemService.yPoint + 160, milkManagementSystemService.tfWidth, milkManagementSystemService.tflHeight); this.milkPriceErrorL = this.addComponent(milkPriceErrorL, milkManagementSystemService.xPoint + milkManagementSystemService.lblWidth + milkManagementSystemService.tfWidth + 40, milkManagementSystemService.yPoint + 160, milkManagementSystemService.lblWidth, milkManagementSystemService.lblHeight); this.milkPriceErrorL.setForeground(Color.RED); this.saveBtn = this.addComponent(this.saveBtn, milkManagementSystemService.xPoint + milkManagementSystemService.lblWidth + 20, milkManagementSystemService.yPoint + 200, 80, 30); this.saveBtn.setText("Save"); this.saveBtn.setForeground(Color.BLUE); this.add(this.saveBtn); this.saveBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { milkPriceErrorL.setText(""); milkPadErrorL.setText(""); milkValueErrorL.setText(""); milkPriceErrorL.setText(""); formerNameErrorL.setText(""); formerIDErrorL.setText(""); if ("".equals(formerIDTF.getText())) { formerIDErrorL.setText(ERROR_FORM); } else if ("".equals(formerNameTF.getText())) { formerNameErrorL.setText(ERROR_FORM); } else if ("".equals(milkPadTF.getText())) { milkPadErrorL.setText(ERROR_FORM); } else if ("".equals(milkValueTF.getText())) { milkValueErrorL.setText(ERROR_FORM); } else if ("".equals(milkPriceTF.getText())) { milkPriceErrorL.setText(ERROR_FORM); } // else if (formerIDCombo.getSelectedItem() == null) { // System.out.println("Former id selection Error"); // } // else if (startdateTimePicker == null) { // System.out.println("date selection Error"); // } else { Milk milk = new Milk(); milk.setFormerID(formerIDCombo.getSelectedItem().toString()); milk.setName(formerNameTF.getText()); milk.setPadValue(milkPadTF.getText()); milk.setQuantity(milkValueTF.getText()); milk.setRate(milkPriceTF.getText()); milk.setDate("dsad"); System.out.println("Im in Former create and save submit action " + milk.toString()); //filePersistenceManager.save(milk); } System.out.println("Im in Former create and update submit action"); } }); this.resetBtn = this.addComponent(this.resetBtn, milkManagementSystemService.xPoint + milkManagementSystemService.lblWidth + 140, milkManagementSystemService.yPoint + 200, 80, 30); this.resetBtn.setText("Reset"); this.resetBtn.setForeground(Color.BLUE); this.add(this.resetBtn); this.resetBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { milkPriceTF.setText(""); milkPadTF.setText(""); milkValueTF.setText(""); milkPriceTF.setText(""); System.out.println("Im in Former create and update submit action"); } }); collectionMonthDetailsJP = new CollectionMonthDetailsJPanel(); collectionMonthDetailsJP.setBounds( milkManagementSystemService.xPoint + milkManagementSystemService.lblWidth * 2 + milkManagementSystemService.tfWidth * 2, milkManagementSystemService.yPoint, (milkManagementSystemService.SCREEN_WIDTH / 2) - milkManagementSystemService.tfWidth / 5, 400); this.add(collectionMonthDetailsJP); List<String> formerIds = persistenceManager.getFormerValues("id"); if (!CollectionUtils.isEmpty(formerIds)) { ids = new String[formerIds.size()]; formerIds.toArray(ids); } formerIDCombo = new JComboBox(ids); // has to be editable formerIDCombo.setEditable(true); // change the editor's document new CustomInitialSelectionComboBox(formerIDCombo); formerIDCombo.setBounds( milkManagementSystemService.xPoint + milkManagementSystemService.lblWidth * 2 + milkManagementSystemService.tfWidth + 40, milkManagementSystemService.yPoint, milkManagementSystemService.lblWidth + 20, milkManagementSystemService.lblHeight + 10); formerIDCombo.setMaximumRowCount(5); this.add(formerIDCombo); List<String> formerNames = persistenceManager.getFormerValues("name"); if (!CollectionUtils.isEmpty(formerNames)) { names = new String[formerNames.size()]; formerNames.toArray(names); } System.out.println("Names1 " + formerNames); formerNameCombo = new JComboBox(names); // has to be editable formerNameCombo.setEditable(true); // change the editor's document new CustomInitialSelectionComboBox(formerNameCombo); //customerIDListScrollPane = new JScrollPane(customerIDCombo); formerNameCombo.setBounds( milkManagementSystemService.xPoint + milkManagementSystemService.lblWidth * 2 + milkManagementSystemService.tfWidth + 40, milkManagementSystemService.yPoint + milkManagementSystemService.lblHeight + 20, milkManagementSystemService.lblWidth + 20, milkManagementSystemService.lblHeight + 10); formerNameCombo.setMaximumRowCount(5); this.add(formerNameCombo); UtilDateModel model = new UtilDateModel(); model.setDate(2016, 04, 16); model.setSelected(true); Properties p = new Properties(); p.put("text.today", "Today"); p.put("text.month", "Month"); p.put("text.year", "Year"); JDatePanelImpl datePanel = new JDatePanelImpl(model, p); datePicker = new JDatePickerImpl(datePanel, new DateLabelFormatter()); datePicker.setBounds( milkManagementSystemService.xPoint + milkManagementSystemService.lblWidth * 2 + milkManagementSystemService.tfWidth + 40, milkManagementSystemService.yPoint + milkManagementSystemService.lblHeight + 60, milkManagementSystemService.lblWidth + 20, milkManagementSystemService.lblHeight + 5); this.add(datePicker); am = new JRadioButton("AM", true); pm = new JRadioButton("PM"); //Group the radio buttons. ButtonGroup amPmgroup = new ButtonGroup(); amPmgroup.add(am); amPmgroup.add(pm); am.setBounds( milkManagementSystemService.xPoint + milkManagementSystemService.lblWidth * 2 + milkManagementSystemService.tfWidth + 40, milkManagementSystemService.yPoint + milkManagementSystemService.lblHeight + 100, milkManagementSystemService.lblWidth / 2, milkManagementSystemService.lblHeight + 5); this.add(am); pm.setBounds( milkManagementSystemService.xPoint + milkManagementSystemService.lblWidth * 2 + milkManagementSystemService.tfWidth + 40 + milkManagementSystemService.lblWidth / 2, milkManagementSystemService.yPoint + milkManagementSystemService.lblHeight + 100, milkManagementSystemService.lblWidth / 2, milkManagementSystemService.lblHeight + 5); this.add(pm); this.search = this.addComponent(this.search, milkManagementSystemService.xPoint + (milkManagementSystemService.lblWidth * 2) + milkManagementSystemService.tfWidth + 60, milkManagementSystemService.yPoint + 200, 80, 30); this.search.setText("Search"); this.search.setForeground(Color.BLUE); this.add(this.search); this.search.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { System.out.println("Im in Former create and update submit action"); System.out.println("Former id" + (String) formerIDCombo.getSelectedItem()); System.out.println("Former name" + (String) formerNameCombo.getSelectedItem()); System.out.println("Am " + am.isSelected()); System.out.println("pm " + pm.isSelected()); String forID = (String) formerIDCombo.getSelectedItem(); String forName = (String) formerNameCombo.getSelectedItem(); String amPMStr = am.isSelected() ? "AM" : "PM"; String dateTime = DateTimeUtil .convertdateToStringeWithTime((Date) datePicker.getModel().getValue()); System.out.println("Seleted date " + dateTime); List<Collection> collectionList = persistenceManager.getCollectionsBy(forID, forName, amPMStr, dateTime); if (!CollectionUtils.isEmpty(collectionList)) { Collection searchCollection = collectionList.get(0); formerNameTF.setText(searchCollection.getFormerName()); ; formerIDTF.setText(searchCollection.getFormerID()); ; milkPadTF.setText(searchCollection.getMilkPad()); ; milkValueTF.setText(searchCollection.getMilkQuantity()); ; milkPriceTF.setText(searchCollection.getMilkPrice()); ; } } }); // UtilDateModel model = new UtilDateModel(); // JDatePanelImpl datePanel = new JDatePanelImpl(model, null); // JDatePickerImpl datePicker = new JDatePickerImpl(datePanel, null); // // this.add(datePicker); // JSpinner timeSpinner = new JSpinner( new SpinnerDateModel() ); // JSpinner.DateEditor timeEditor = new JSpinner.DateEditor(timeSpinner, "HH:mm:ss"); // timeSpinner.setEditor(timeEditor); // timeSpinner.setValue(new Date()); // timeSpinner.setBounds(); // this.add(timeSpinner); // DateTimePicker dateTimePicker = new DateTimePicker(); // dateTimePicker.setFormats( DateFormat.getDateTimeInstance( DateFormat.SHORT, DateFormat.MEDIUM ) ); // dateTimePicker.setTimeFormat( DateFormat.getTimeInstance( DateFormat.MEDIUM ) ); // dateTimePicker.setDate(new Date()); // dateTimePicker.setBounds(milkManagementSystemService.xPoint // + (milkManagementSystemService.lblWidth*2)+milkManagementSystemService.tfWidth+60, // milkManagementSystemService.yPoint + 200, 80, 30); // this.add(dateTimePicker); }
From source file:mavn.network.view.JUNGPanelAdapter.java
/** * Create an instance of a simple graph with popup controls to * create a graph./*from w ww . j av a 2 s .co m*/ * */ public JUNGPanelAdapter(double[][] w2, double[][] w1, double[][] w0) { this.w2 = w2; this.w1 = w1; this.w0 = w0; this.setPreferredSize(new Dimension(600, 400)); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); // create a simple graph for the demo graph = new DirectedSparseMultigraph<Number, Number>(); this.layout = new StaticLayout<Number, Number>(graph, new Dimension(600, 600)); if (w2.length > 0) { findIndicies(); createVerticies(); drawEdges(); drawVerticies(); } vv = new VisualizationViewer<Number, Number>(layout); vv.setBackground(Color.getColor("#333333")); vv.getRenderContext().setVertexLabelTransformer(MapTransformer.<Number, String>getInstance( LazyMap.<Number, String>decorate(new HashMap<Number, String>(), new ToStringLabeller<Number>()))); vv.setVertexToolTipTransformer(vv.getRenderContext().getVertexLabelTransformer()); vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line()); final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); this.add(panel); final EditingModalGraphMouse<Number, Number> graphMouse = new EditingModalGraphMouse<Number, Number>( vv.getRenderContext(), vertexFactory, edgeFactory); Transformer<Number, Paint> vertexPaint = new Transformer<Number, Paint>() { @Override public Paint transform(Number i) { return Color.getHSBColor(0, 0.73f, 1); } }; vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint); // the EditingGraphMouse will pass mouse event coordinates to the // vertexLocations function to set the locations of the vertices as // they are created // graphMouse.setVertexLocations(vertexLocations); vv.setGraphMouse(graphMouse); vv.addKeyListener(graphMouse.getModeKeyListener()); graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); JPanel controls = new JPanel(); controls.add(plus); controls.add(minus); this.add(controls); this.setVisible(true); }
From source file:net.automatalib.visualization.jung.JungGraphVisualizationProvider.java
protected static Color getColor(Map<String, String> props, String propName, Color defColor) { String colName = props.get(propName); if (colName == null) { return defColor; }/*from w w w . java 2s .c o m*/ Color col = Color.getColor(colName); if (col == null) { return defColor; } return col; }
From source file:de.vandermeer.svg2vector.base.Cli.java
/** * Sets all command line arguments in the given property object. * @param props object with properties to set *///from w w w. j a v a 2 s. com public void setProperties(TargetProperties props) { //flags that require SVG to process things if (this.line.hasOption('i')) { props.setUseInkscapeLayerName(); } if (this.line.hasOption('I')) { props.setUseInkscapeLayerIndex(); } if (this.line.hasOption('l')) { props.setUseOnePerInkscapeLayer(); } //flags that are simply set in UserProperties if (this.line.hasOption('n')) { props.setPropertyTransparent(false); } if (this.line.hasOption('s')) { props.setPropertyTextAsShapes(false); } if (this.line.hasOption('c')) { props.setPropertyClip(true); } if (this.line.hasOption('b')) { props.setPropertyBackground(false); } if (this.line.hasOption('r')) { Color color = Color.getColor(this.line.getOptionValue('r')); props.setPropertyBackgroundColor(color); } }