List of usage examples for java.awt Rectangle Rectangle
public Rectangle(int x, int y, int width, int height)
From source file:net.pms.newgui.components.WindowProperties.java
private boolean updateEffectiveScreenBounds() { if (screenBounds == null) { return false; }/*from w w w. jav a2 s . c o m*/ Insets tmpInsets = screenInsets == null ? new Insets(0, 0, 0, 0) : screenInsets; Rectangle newEffectiveScreenBounds = new Rectangle(screenBounds.x, screenBounds.y, screenBounds.width - tmpInsets.left - tmpInsets.right, screenBounds.height - tmpInsets.top - tmpInsets.bottom); if (!newEffectiveScreenBounds.equals(effectiveScreenBounds)) { effectiveScreenBounds = newEffectiveScreenBounds; return true; } return false; }
From source file:edu.purdue.cc.bionet.ui.HeatMap.java
/** * This method retrieves a heatmap image from jfreechart and places it on the panel * along with black divider lines and labels to create a heat map graph. * /* w w w . ja v a 2s .c om*/ * @param g The Graphics for the jpanel. */ public void paintComponent(Graphics g) { super.paintComponent(g); if (moleculeList.size() > 0) { float tickStep; BufferedImage drawing = HeatMapUtilities.createHeatMapImage(this.getDataset(), this.spectrum); int leftEdge = this.getWidth() / 8; int topEdge = this.getHeight() / 32; int bottomEdge = this.getHeight() * 7 / 8; int rightEdge = this.getWidth() * 31 / 32; mapPosition = new Rectangle(leftEdge, topEdge, rightEdge - leftEdge, bottomEdge - topEdge); g.drawImage(drawing, leftEdge, topEdge, rightEdge - leftEdge, bottomEdge - topEdge, this.getBackground(), this); // y-axis int yAxisPos = leftEdge - 1; // g.drawLine( yAxisPos, topEdge, yAxisPos, bottomEdge ); tickStep = (bottomEdge - topEdge) / (float) moleculeList.size(); for (int i = 0; i <= moleculeList.size(); i++) { int tickY = Math.round(topEdge + i * tickStep); g.drawLine(rightEdge, tickY, yAxisPos - tickSize, tickY); if (i < moleculeList.size()) { String name = this.moleculeList.get(this.moleculeList.size() - 1 - i).toString(); g.drawString(name, yAxisPos - 4 - g.getFontMetrics().stringWidth(name), (int) (tickY + tickStep)); } } // x-axis int xAxisPos = bottomEdge; tickStep = (rightEdge - leftEdge) / (float) moleculeList.size(); // g.drawLine( leftEdge, xAxisPos, rightEdge, xAxisPos ); for (int i = 0; i <= moleculeList.size(); i++) { int tickX = (int) (leftEdge + i * tickStep); g.drawLine(tickX, topEdge, tickX, xAxisPos + tickSize); } // transform clockwise 90 degrees for the vertical text AffineTransform at = new AffineTransform(); at.quadrantRotate(3); Graphics2D g2d = (Graphics2D) g.create(); g2d.transform(at); for (int i = 0; i < moleculeList.size(); i++) { int tickX = Math.round(leftEdge + i * tickStep); String name = this.moleculeList.get(i).toString(); g2d.drawString(name, -(int) (xAxisPos + 4 + g.getFontMetrics().stringWidth(name)), (int) (tickX + tickStep)); } } }
From source file:com.funambol.admin.settings.panels.EditServerConfigurationPanel.java
/** * Create the panel/*w w w . j a v a 2s .co m*/ * @throws Exception if error occures during creation of the panel. */ private void init() throws Exception { final int dy = 25; int y = 25; int x1 = 15; int w1 = 140; int w2 = 350; int dx = 21; int x2 = x1 + w1 + dx; setAutoscrolls(true); setLayout(null); setName(Bundle.getMessage(Bundle.EDIT_SERVER_CONFIGURATION_PANEL_NAME)); panelNameLabel.setText(Bundle.getMessage(Bundle.EDIT_SERVER_CONFIGURATION_PANEL_NAME)); panelNameLabel.setBounds(new Rectangle(14, 5, 216, 28)); panelNameLabel.setAlignmentX(SwingConstants.CENTER); panelNameLabel.setBorder(new TitledBorder("")); y += dy; titleSectionDevInfo.setText(Bundle.getMessage(Bundle.LABEL_DEV_INF)); titleSectionDevInfo.setBounds(new Rectangle(14, y, 162, 28)); titleSectionDevInfo.setAlignmentX(SwingConstants.CENTER); titleSectionDevInfo.setBorder(new TitledBorder("")); y += dy; y += 10; manLabel.setText(Bundle.getMessage(Bundle.LABEL_MAN) + " :"); manLabel.setBounds(new Rectangle(x1, y, w1, 18)); man.setBounds(new Rectangle(x2, y, w2, 18)); y += dy; modLabel.setText(Bundle.getMessage(Bundle.LABEL_MOD) + " :"); modLabel.setBounds(new Rectangle(x1, y, w1, 18)); mod.setBounds(new Rectangle(x2, y, w2, 18)); y += dy; swVLabel.setText(Bundle.getMessage(Bundle.LABEL_SWV) + " :"); swVLabel.setBounds(new Rectangle(x1, y, w1, 18)); swV.setBounds(new Rectangle(x2, y, w2, 18)); swV.setEditable(false); y += dy; hwVLabel.setText(Bundle.getMessage(Bundle.LABEL_HWV) + " :"); hwVLabel.setBounds(new Rectangle(x1, y, w1, 18)); hwV.setBounds(new Rectangle(x2, y, w2, 18)); y += dy; fwVLabel.setText(Bundle.getMessage(Bundle.LABEL_FWV) + " :"); fwVLabel.setBounds(new Rectangle(x1, y, w1, 18)); fwV.setBounds(new Rectangle(x2, y, w2, 18)); y += dy; oemLabel.setText(Bundle.getMessage(Bundle.LABEL_OEM) + " :"); oemLabel.setBounds(new Rectangle(x1, y, w1, 18)); oem.setBounds(new Rectangle(x2, y, w2, 18)); y += dy; devIdLabel.setText(Bundle.getMessage(Bundle.LABEL_DEV_ID) + " :"); devIdLabel.setBounds(new Rectangle(x1, y, w1, 18)); devId.setBounds(new Rectangle(x2, y, w2, 18)); y += dy; devTypLabel.setText(Bundle.getMessage(Bundle.LABEL_DEV_TYP) + " :"); devTypLabel.setBounds(new Rectangle(x1, y, w1, 18)); devTyp.setBounds(new Rectangle(x2, y, w2, 18)); y += dy; verDTDLabel.setText(Bundle.getMessage(Bundle.LABEL_VER_DTD) + " :"); verDTDLabel.setBounds(new Rectangle(x1, y, w1, 18)); verDTD.setBounds(new Rectangle(x2, y, w2, 18)); y += dy; y += 10; titleSectionEngineInfo.setText(Bundle.getMessage(Bundle.LABEL_ENGINE_INFO)); titleSectionEngineInfo.setBounds(new Rectangle(14, y, 162, 28)); titleSectionEngineInfo.setAlignmentX(SwingConstants.CENTER); titleSectionEngineInfo.setBorder(new TitledBorder("")); y += 10; y += dy; serverUriLabel.setText(Bundle.getMessage(Bundle.LABEL_SERVER_URI) + " :"); serverUriLabel.setBounds(new Rectangle(x1, y, w1, 18)); serverUri.setBounds(new Rectangle(x2, y, w2, 18)); y += dy; officerLabel.setText(Bundle.getMessage(Bundle.LABEL_OFFICER) + " :"); officerLabel.setBounds(new Rectangle(x1, y, w1, 18)); officer.setBounds(new Rectangle(x2, y, w2, 18)); y += dy; handlerLabel.setText(Bundle.getMessage(Bundle.LABEL_HANDLER) + " :"); handlerLabel.setBounds(new Rectangle(x1, y, w1, 18)); handler.setBounds(new Rectangle(x2, y, w2, 18)); y += dy; deviceInventoryLabel.setText(Bundle.getMessage(Bundle.LABEL_DEVICE_INVENTORY) + " :"); deviceInventoryLabel.setBounds(new Rectangle(x1, y, w1, 18)); deviceInventory.setBounds(new Rectangle(x2, y, w2, 18)); y += dy; dataTransformerManagerLabel.setText(Bundle.getMessage(Bundle.LABEL_DATA_TRANSFORMER_MANAGER) + " :"); dataTransformerManagerLabel.setBounds(new Rectangle(x1, y, w1, 18)); dataTransformerManager.setBounds(new Rectangle(x2, y, w2, 18)); dataTransformerButton.setBounds(new Rectangle(x2 + w2 + 10, y, 85, 18)); dataTransformerButton.setText(Bundle.getMessage(Bundle.DATA_TRANSFORMER_CONFIGURE_BUTTON)); dataTransformerButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String path = dataTransformerManager.getText(); try { ExplorerUtil.getSyncAdminController().getServerSettingsController() .editDataTrasnformerConfiguration(path); } catch (AdminException ex) { String msg = Bundle.getMessage(Bundle.ERROR_GETTING_DTM_CONFIGURATION); NotifyDescriptor desc = new NotifyDescriptor.Message(ex.getMessage()); DialogDisplayer.getDefault().notify(desc); Log.error(msg, ex); return; } } }); y += dy; strategyLabel.setText(Bundle.getMessage(Bundle.LABEL_STRATEGY) + " :"); strategyLabel.setBounds(new Rectangle(x1, y, w1, 18)); strategy.setBounds(new Rectangle(x2, y, w2, 18)); strategyButton.setBounds(new Rectangle(x2 + w2 + 10, y, 85, 18)); strategyButton.setText(Bundle.getMessage(Bundle.LABEL_BUTTON_CONFIGURE)); strategyButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String path = strategy.getText(); try { ExplorerUtil.getSyncAdminController().getServerSettingsController() .editStrategyConfiguration(path); } catch (AdminException ex) { String msg = Bundle.getMessage(Bundle.ERROR_GETTING_STRATEGY_CONFIGURATION); NotifyDescriptor desc = new NotifyDescriptor.Message(ex.getMessage()); DialogDisplayer.getDefault().notify(desc); Log.error(msg, ex); return; } } }); y += dy; userManagerLabel.setText(Bundle.getMessage(Bundle.LABEL_USER_MANAGER) + " :"); userManagerLabel.setBounds(new Rectangle(x1, y, w1, 18)); userManager.setBounds(new Rectangle(x2, y, w2, 18)); y += dy; smsServiceLabel.setText(Bundle.getMessage(Bundle.LABEL_SMS_SERVICE) + " :"); smsServiceLabel.setBounds(new Rectangle(x1, y, w1, 18)); smsService.setBounds(new Rectangle(x2, y, w2, 18)); y += dy; minMaxMsgSizeLabel.setText(Bundle.getMessage(Bundle.LABEL_MIN_MAX_MSG_SIZE) + " :"); minMaxMsgSizeLabel.setBounds(new Rectangle(x1, y, w1, 18)); minMaxMsgSize.setBounds(new Rectangle(x2, y, w2, 18)); y += dy; checkForUpdatesLabel.setText(Bundle.getMessage(Bundle.LABEL_CHECK_FOR_UPDATES) + " :"); checkForUpdatesLabel.setBounds(new Rectangle(x1, y, w1, 18)); checkForUpdates.setBounds(new Rectangle(x2, y, w2, 18)); y += dy; y += dy; confirmButton.setText(Bundle.getMessage(Bundle.LABEL_BUTTON_SAVE)); confirmButton.setBounds(new Rectangle(225, y, 60, 25)); confirmButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setServerConfiguration(); } }); cancelButton = new JButton(Bundle.getMessage(Bundle.LABEL_BUTTON_CANCEL)); cancelButton.setBounds(290, y, 70, 25); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { cancelAction(); } }); //add components to panel add(panelNameLabel, null); add(titleSectionDevInfo, null); add(manLabel, null); add(man, null); add(modLabel, null); add(mod, null); add(swVLabel, null); add(swV, null); add(hwVLabel, null); add(hwV, null); add(fwVLabel, null); add(fwV, null); add(oemLabel, null); add(oem, null); add(devIdLabel, null); add(devId, null); add(devTypLabel, null); add(devTyp, null); add(verDTDLabel, null); add(verDTD, null); add(titleSectionEngineInfo, null); add(serverUriLabel, null); add(serverUri, null); add(officerLabel, null); add(officer, null); add(handlerLabel, null); add(handler, null); add(deviceInventoryLabel, null); add(deviceInventory, null); add(dataTransformerManagerLabel, null); add(dataTransformerManager, null); add(dataTransformerButton, null); add(strategyLabel, null); add(strategy, null); add(strategyButton, null); add(userManagerLabel, null); add(userManager, null); add(smsServiceLabel, null); add(smsService, null); add(minMaxMsgSizeLabel, null); add(minMaxMsgSize, null); add(checkForUpdatesLabel, null); add(checkForUpdates, null); add(confirmButton, null); add(cancelButton, null); GuiFactory.setDefaultFont(this); panelNameLabel.setFont(GuiFactory.titlePanelFont); titleSectionEngineInfo.setFont(new java.awt.Font("Arial", 2, 12)); titleSectionDevInfo.setFont(new java.awt.Font("Arial", 2, 12)); }
From source file:ImageOpByRomain.java
/** * {@inheritDoc} */ public Rectangle2D getBounds2D(BufferedImage src) { return new Rectangle(0, 0, src.getWidth(), src.getHeight()); }
From source file:com.funambol.foundation.admin.PIMSyncSourceConfigPanel.java
/** * Creates the panel's components and layout. * @todo adjust layout//from w w w. jav a 2s. c o m */ private void init() { // set layout this.setLayout(null); // set properties of label, position and border // referred to the title of the panel titledBorder = new TitledBorder(""); panelName.setFont(titlePanelFont); panelName.setText(getPanelName()); panelName.setBounds(new Rectangle(14, 5, 316, 28)); panelName.setAlignmentX(SwingConstants.CENTER); panelName.setBorder(titledBorder); final int LABEL_X = 14; final int VALUE_X = 170; int y = 60; final int GAP_X = 150; final int GAP_Y = 30; sourceUriLabel.setText("Source URI: "); sourceUriLabel.setFont(defaultFont); sourceUriLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18)); sourceUriValue.setFont(defaultFont); sourceUriValue.setBounds(new Rectangle(VALUE_X, y, 350, 18)); y += GAP_Y; // New line nameLabel.setText("Name: "); nameLabel.setFont(defaultFont); nameLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18)); nameValue.setFont(defaultFont); nameValue.setBounds(new Rectangle(VALUE_X, y, 350, 18)); y += GAP_Y; // New line typeLabel.setText("Type: "); typeLabel.setFont(defaultFont); typeLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18)); typeCombo.setFont(defaultFont); typeCombo.setBounds(new Rectangle(VALUE_X, y, 350, 18)); // What happens when the Type value is changed? typeCombo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (isSIFSelected()) { encoding.setSelected(true); // SIFs always encoded encoding.setEnabled(false); } else { encryption.setSelected(false); encoding.setSelected(false); encoding.setEnabled(true); } } }); y += GAP_Y; // New line int x = LABEL_X; y = addExtraComponents(x, y, GAP_X, GAP_Y); // Add other components, if needed encryption.setText("Encrypt data"); encryption.setFont(defaultFont); encryption.setSelected(false); encryption.setBounds(x, y, 150, 25); // What happens if the encryption is enabled? encryption.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == e.SELECTED) { encoding.setSelected(true); // Encryption implies encoding encoding.setEnabled(false); } if (e.getStateChange() == e.DESELECTED) { if (!isSIFSelected()) { encoding.setEnabled(true); } } } }); y += GAP_Y; // New line encoding.setText("Encode data in Base 64"); encoding.setFont(defaultFont); encoding.setSelected(false); encoding.setBounds(x, y, 150, 25); y += GAP_Y; // New line y += GAP_Y; // New line confirmButton.setFont(defaultFont); confirmButton.setText("Add"); confirmButton.setBounds(VALUE_X, y, 70, 25); // What happens when the confirmButton is pressed? confirmButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { validateValues(); getValues(); if (getState() == STATE_INSERT) { PIMSyncSourceConfigPanel.this.actionPerformed(new ActionEvent(PIMSyncSourceConfigPanel.this, ACTION_EVENT_INSERT, event.getActionCommand())); } else { PIMSyncSourceConfigPanel.this.actionPerformed(new ActionEvent(PIMSyncSourceConfigPanel.this, ACTION_EVENT_UPDATE, event.getActionCommand())); } } catch (Exception e) { notifyError(new AdminException(e.getMessage(), e)); } } }); // Adds all components to the panel this.add(panelName, null); this.add(nameLabel, null); this.add(sourceUriLabel, null); this.add(sourceUriValue, null); this.add(nameValue, null); this.add(typeLabel, null); this.add(typeCombo, null); this.add(encryption, null); this.add(encoding, null); this.add(confirmButton, null); }
From source file:de.dakror.villagedefense.game.entity.struct.Struct.java
@Override public boolean mousePressed(MouseEvent e) { if (guiPoint != null && guiSize != null) e.translatePoint(-(guiPoint.x - guiSize.width / 2), -(guiPoint.y - guiSize.height / 2)); for (Component c : components) c.mousePressed(e);//from w ww .ja v a2 s . c om if (guiPoint != null && guiSize != null) e.translatePoint(guiPoint.x - guiSize.width / 2, guiPoint.y - guiSize.height / 2); boolean pressed = super.mousePressed(e); if (pressed && guiPoint == null && guiSize != null) { guiPoint = e.getPoint(); guiPoint.translate(Game.world.x, Game.world.y); if (guiPoint.x - guiSize.width / 2 < 0) guiPoint.x = guiSize.width / 2; if (guiPoint.y - guiSize.height / 2 < 0) guiPoint.y = guiSize.height / 2; if (guiPoint.x + guiSize.width / 2 > Game.getWidth()) guiPoint.x = Game.getWidth() - guiSize.width / 2; if (guiPoint.y + guiSize.height / 2 > Game.getHeight()) guiPoint.y = Game.getHeight() - guiSize.height / 2; } else { if (guiPoint != null && guiSize != null && !new Rectangle(guiPoint.x - guiSize.width / 2, guiPoint.y - guiSize.height / 2, guiSize.width, guiSize.height).contains(e.getPoint())) { destroyGUI(); } } return pressed; }
From source file:com.funambol.exchange.admin.ExchangeSyncSourceConfigPanel.java
/** * Creates the panel's components and layout. * @todo adjust layout// w ww . j a v a 2 s .co m */ private void init() { // set layout this.setLayout(null); // set properties of label, position and border // referred to the title of the panel titledBorder = new TitledBorder(""); panelName.setFont(titlePanelFont); panelName.setText(getPanelName()); panelName.setBounds(new Rectangle(14, 5, 316, 28)); panelName.setAlignmentX(SwingConstants.CENTER); panelName.setBorder(titledBorder); final int LABEL_X = 14; final int VALUE_X = 170; int y = 60; final int GAP_X = 150; final int GAP_Y = 30; sourceUriLabel.setText("Source URI: "); sourceUriLabel.setFont(defaultFont); sourceUriLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18)); sourceUriValue.setFont(defaultFont); sourceUriValue.setBounds(new Rectangle(VALUE_X, y, 350, 18)); y += GAP_Y; // New line nameLabel.setText("Name: "); nameLabel.setFont(defaultFont); nameLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18)); nameValue.setFont(defaultFont); nameValue.setBounds(new Rectangle(VALUE_X, y, 350, 18)); y += GAP_Y; // New line y += GAP_Y; // New line typeLabel.setText("Type: "); typeLabel.setFont(defaultFont); typeLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18)); typeCombo.setFont(defaultFont); typeCombo.setBounds(new Rectangle(VALUE_X, y, 350, 18)); // What happens when the Type value is changed? typeCombo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (isSIFSelected()) { encoding.setSelected(true); // SIFs always encoded encoding.setEnabled(false); } else { encryption.setSelected(false); encoding.setSelected(false); encoding.setEnabled(true); } } }); y += GAP_Y; // New line int x = LABEL_X; y = addExtraComponents(x, y, GAP_X, GAP_Y); // Add other components, if needed encryption.setText("Encrypt data"); encryption.setFont(defaultFont); encryption.setSelected(false); encryption.setBounds(x, y, 150, 25); // What happens if the encryption is enabled? encryption.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == e.SELECTED) { encoding.setSelected(true); // Encryption implies encoding encoding.setEnabled(false); } if (e.getStateChange() == e.DESELECTED) { if (!isSIFSelected()) { encoding.setEnabled(true); } } } }); y += GAP_Y; // New line encoding.setText("Encode data in Base 64"); encoding.setFont(defaultFont); encoding.setSelected(false); encoding.setBounds(x, y, 150, 25); y += GAP_Y; // New line y += GAP_Y; // New line confirmButton.setFont(defaultFont); confirmButton.setText("Add"); confirmButton.setBounds(VALUE_X, y, 70, 25); // What happens when the confirmButton is pressed? confirmButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { validateValues(); getValues(); if (getState() == STATE_INSERT) { ExchangeSyncSourceConfigPanel.this.actionPerformed(new ActionEvent( ExchangeSyncSourceConfigPanel.this, ACTION_EVENT_INSERT, event.getActionCommand())); } else { ExchangeSyncSourceConfigPanel.this.actionPerformed(new ActionEvent( ExchangeSyncSourceConfigPanel.this, ACTION_EVENT_UPDATE, event.getActionCommand())); } } catch (Exception e) { notifyError(new AdminException(e.getMessage(), e)); } } }); // Adds all components to the panel this.add(panelName, null); this.add(nameLabel, null); this.add(sourceUriLabel, null); this.add(sourceUriValue, null); this.add(nameValue, null); this.add(typeLabel, null); this.add(typeCombo, null); this.add(encryption, null); this.add(encoding, null); this.add(confirmButton, null); }
From source file:keel.Algorithms.UnsupervisedLearning.AssociationRules.Visualization.keelassotiationrulesboxplot.ResultsProccessor.java
public void writeToFile(String outName) throws FileNotFoundException, UnsupportedEncodingException, IOException { //calcMeans(); // Create JFreeChart Dataset DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); HashMap<String, ArrayList<Double>> measuresFirst = algorithmMeasures.entrySet().iterator().next() .getValue();//from w w w . j a v a 2s .c o m for (Map.Entry<String, ArrayList<Double>> measure : measuresFirst.entrySet()) { String measureName = measure.getKey(); //Double measureValue = measure.getValue(); dataset.clear(); for (Map.Entry<String, HashMap<String, ArrayList<Double>>> entry : algorithmMeasures.entrySet()) { String alg = entry.getKey(); ArrayList<Double> measureValues = entry.getValue().get(measureName); // Parse algorithm name to show it correctly String aName = alg.substring(0, alg.length() - 1); int startAlgName = aName.lastIndexOf("/"); aName = aName.substring(startAlgName + 1); dataset.add(measureValues, aName, measureName); } // Tutorial: http://www.java2s.com/Code/Java/Chart/JFreeChartBoxAndWhiskerDemo.htm final CategoryAxis xAxis = new CategoryAxis("Algorithm"); final NumberAxis yAxis = new NumberAxis("Value"); yAxis.setAutoRangeIncludesZero(false); final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); // Black and White int numItems = algorithmMeasures.size(); for (int i = 0; i < numItems; i++) { Color color = Color.DARK_GRAY; if (i % 2 == 1) { color = Color.LIGHT_GRAY; } renderer.setSeriesPaint(i, color); renderer.setSeriesOutlinePaint(i, Color.BLACK); } renderer.setMeanVisible(false); renderer.setFillBox(false); renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator()); final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); Font font = new Font("SansSerif", Font.BOLD, 10); //ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jchart = new JFreeChart("Assotiation Rules Measures - BoxPlot", font, plot, true); //StandardChartTheme.createLegacyTheme().apply(jchart); int width = 640 * 2; /* Width of the image */ int height = 480 * 2; /* Height of the image */ // JPEG File chart = new File(outName + "_" + measureName + "_boxplot.jpg"); ChartUtilities.saveChartAsJPEG(chart, jchart, width, height); // SVG SVGGraphics2D g2 = new SVGGraphics2D(width, height); Rectangle r = new Rectangle(0, 0, width, height); jchart.draw(g2, r); File BarChartSVG = new File(outName + "_" + measureName + "_boxplot.svg"); SVGUtils.writeToSVG(BarChartSVG, g2.getSVGElement()); } }
From source file:edu.uchc.octane.OctaneWindowControl.java
/** * Draw a small box around the current particle *///ww w . j a v a 2s . co m protected void drawBox() { SmNode node = frame_.getNodesTable().getCurrentNode(); int x, y; if (node != null && imp_ != null) { imp_.setSlice(node.frame); x = (int) Math.round(node.x); y = (int) Math.round(node.y); imp_.setRoi(x - 5, y - 5, 11, 11); ImageCanvas canvas = imp_.getCanvas(); Rectangle r = canvas.getSrcRect(); int sx = canvas.screenX(x); int sy = canvas.screenY(y); if (sx < 4 || sx > r.width - 5 || sy < 4 || sy > r.height - 5) { int nx = Math.max(x - r.width / 2, 0); int ny = Math.max(y - r.height / 2, 0); if (nx + r.width > imp_.getWidth()) { nx = imp_.getWidth() - r.width; } if (ny + r.height > imp_.getHeight()) { ny = imp_.getHeight() - r.height; } canvas.setSourceRect(new Rectangle(nx, ny, r.width, r.height)); imp_.updateAndDraw(); } } }
From source file:com.tulskiy.musique.system.configuration.Configuration.java
public Rectangle getRectangle(String key, Rectangle def) { try {/*from www . ja va 2 s . co m*/ String value = getString(key); String[] tokens = value.split(" "); if (tokens.length != 4) throw new NumberFormatException(); int[] values = new int[4]; for (int i = 0; i < tokens.length; i++) { String s = tokens[i]; values[i] = Integer.parseInt(s); } return new Rectangle(values[0], values[1], values[2], values[3]); } catch (Exception e) { setRectangle(key, def); return def; } }