List of usage examples for java.awt Color cyan
Color cyan
To view the source code for java.awt Color cyan.
Click Source Link
From source file:com.github.andreax79.meca.Main.java
public static Stats drawRule(int ruleNumber, int size, Boundaries boundaries, UpdatePattern updatePattern, int steps, double alpha, String pattern, Output output, ColorScheme colorScheme) throws IOException { Rule rule = new Rule(ruleNumber); Row row = new Row(size, rule, boundaries, updatePattern, pattern, alpha); // e.g. 00010011011111 Stats stats = new Stats(); FileOutputStream finalImage = null; Graphics2D g = null;//from w ww . ja va 2 s .co m BufferedImage img = null; if (output != Output.noOutput) { String fileName = "rule" + ruleNumber; // pattern if (pattern != null) fileName += pattern; // alpha if (alpha > 0) fileName += String.format("_a%02d", (int) (alpha * 100)); // updatePattern if (updatePattern != UpdatePattern.synchronous) fileName += "-" + updatePattern; fileName += ".jpeg"; File file = new File(fileName); finalImage = new FileOutputStream(file); int width = (int) (cellSize * (size + 1) * (output == Output.all ? 1.25 : 1)); int height = cellSize * (steps + 1); img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); g = img.createGraphics(); g.setBackground(Color.white); g.clearRect(0, 0, width, height); g.setColor(Color.black); } int startMeansFromStep = 50; List<Double> densities = new LinkedList<Double>(); double totalDensities = 0; double prevValue = 0; double prevDelta = 0; double prevOnes = 0; double prevOnesDelta = 0; for (int t = 0; t < steps; t++) { if (t >= startMeansFromStep) { double density = row.getDensity(); densities.add(density); totalDensities += density; } // System.out.println(String.format("%4d", t) + " " + row.toString() + " ones=" + row.getOnes()); if (output != Output.noOutput) { for (int j = 0; j < row.getSize(); j++) { switch (colorScheme) { case noColor: if (row.getCell(j).getState()) { g.setColor(Color.black); g.fillRect(j * cellSize, t * cellSize, cellSize, cellSize); } break; case omegaColor: g.setColor(row.getCell(j).getOmegaColor()); g.fillRect(j * cellSize, t * cellSize, cellSize, cellSize); break; case activationColor: if (row.getCell(j).getState()) { g.setColor(row.getCell(j).getColor()); g.fillRect(j * cellSize, t * cellSize, cellSize, cellSize); } break; } } if (output == Output.all) { double value = row.getValue(); double delta = Math.abs(value - prevValue); double ones = row.getOnes(); double onesDelta = Math.abs(ones - prevOnes); if (t > 0) { g.setColor(Color.red); g.drawLine((int) (prevValue * cellSize / 4.0) + cellSize * (size + 1), (int) ((t - 1) * cellSize), (int) (value * cellSize / 4.0) + cellSize * (size + 1), (int) (t * cellSize)); g.setColor(Color.blue); g.drawLine((int) (prevOnes * cellSize / 4.0) + cellSize * (size + 1), (int) ((t - 1) * cellSize), (int) (ones * cellSize / 4.0) + cellSize * (size + 1), (int) (t * cellSize)); if (t > 1) { g.setColor(Color.orange); g.drawLine((int) (prevDelta * cellSize / 4.0) + cellSize * (size + 1), (int) ((t - 1) * cellSize), (int) (delta * cellSize / 4.0) + cellSize * (size + 1), (int) (t * cellSize)); g.setColor(Color.cyan); g.drawLine((int) (prevOnesDelta * cellSize / 4.0) + cellSize * (size + 1), (int) ((t - 1) * cellSize), (int) (onesDelta * cellSize / 4.0) + cellSize * (size + 1), (int) (t * cellSize)); } } prevValue = value; prevDelta = delta; prevOnes = ones; prevOnesDelta = onesDelta; } } row = new Row(row); } double means = totalDensities / densities.size(); double var = 0; for (double density : densities) var += Math.pow(density - means, 2); var = var / densities.size(); System.out.println("Rule: " + ruleNumber + " Boundaties: " + boundaries + " UpdatePattern: " + updatePattern + " Alpha: " + String.format("%.3f", alpha) + " Means: " + String.format("%.6f", means) + " Variance: " + String.format("%.6f", var)); stats.setMeans(means); stats.setVariance(var); if (output != Output.noOutput) { JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(finalImage); JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(img); param.setQuality(1.0f, true); encoder.encode(img, param); finalImage.flush(); finalImage.close(); } return stats; }
From source file:net.sf.dynamicreports.test.jasper.chart.HighLowChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);//from w w w. ja v a 2s. c om JFreeChart chart = getChart("summary.chart1", 0); XYItemRenderer renderer = chart.getXYPlot().getRenderer(); Assert.assertEquals("renderer", HighLowRenderer.class, renderer.getClass()); Assert.assertEquals("show open ticks", true, ((HighLowRenderer) renderer).getDrawOpenTicks()); Assert.assertEquals("show close ticks", true, ((HighLowRenderer) renderer).getDrawCloseTicks()); highLowChartDataTest(chart, 0, new Object[][] { { "serie", date1, 50d, 35d, 40d, 47d, 70d }, { "serie", date2, 55d, 40d, 50d, 45d, 120d }, { "serie", date3, 48d, 41d, 42d, 47d, 90d } }); chart = getChart("summary.chart2", 0); Axis axis = chart.getXYPlot().getDomainAxis(); Assert.assertEquals("category label", "time", axis.getLabel()); Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); Assert.assertTrue("vertical tick labels", ((ValueAxis) axis).isVerticalTickLabels()); chart = getChart("summary.chart3", 0); axis = chart.getXYPlot().getRangeAxis(); Assert.assertEquals("value label", "value", axis.getLabel()); Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10)); //Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound()); Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound()); Assert.assertTrue("vertical tick labels", ((ValueAxis) axis).isVerticalTickLabels()); }
From source file:renderer.DependencyGrapher.java
/** * create an instance of a simple graph in two views with controls to * demo the features.// w ww . j a v a 2 s . c o m * */ public DependencyGrapher() { // create a simple graph for the demo final DependencyDirectedSparceMultiGraph<String, Number> graph = createGraph(); //TestGraphs.getOneComponentGraph(); // the preferred sizes for the two views // create one layout for the graph final FRLayout2<String, Number> layout = new FRLayout2<String, Number>(graph); layout.setMaxIterations(500); VisualizationModel<String, Number> vm = new DefaultVisualizationModel<String, Number>(layout, preferredSize1); Transformer<Number, String> stringer = new Transformer<Number, String>() { public String transform(Number e) { if (graph.getEdgeAttributes(e) != null) { return graph.getEdgeAttributes(e).toString(); } return null; } }; // create 2 views that share the same model final VisualizationViewer<String, Number> vv = new VisualizationViewer<String, Number>(vm, preferredSize1); vv.setBackground(Color.white); vv.getRenderContext().setEdgeLabelTransformer(stringer); vv.getRenderContext().setEdgeDrawPaintTransformer( new PickableEdgePaintTransformer<String, Number>(vv.getPickedEdgeState(), Color.black, Color.cyan)); vv.getRenderContext().setVertexFillPaintTransformer( new PickableVertexPaintTransformer<String>(vv.getPickedVertexState(), Color.red, Color.yellow)); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<String>()); vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.AUTO); // add default listener for ToolTips vv.setVertexToolTipTransformer(new ToStringLabeller<String>()); // ToolTipManager.sharedInstance().setDismissDelay(10000); Container content = getContentPane(); Container panel = new JPanel(new BorderLayout()); GraphZoomScrollPane gzsp = new GraphZoomScrollPane(vv); panel.add(gzsp); helpDialog = new JDialog(); helpDialog.getContentPane().add(new JLabel(instructions)); RenderContext<String, Number> rc = vv.getRenderContext(); AnnotatingGraphMousePlugin annotatingPlugin = new AnnotatingGraphMousePlugin(rc); // create a GraphMouse for the main view // final AnnotatingModalGraphMouse graphMouse = new AnnotatingModalGraphMouse(rc, annotatingPlugin); vv.setGraphMouse(graphMouse); vv.addKeyListener(graphMouse.getModeKeyListener()); final ScalingControl scaler = new CrossoverScalingControl(); JButton filterReset = new JButton("Reset"); filterReset.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { vv.getModel().setGraphLayout(layout); } }); JButton filterFilter = new JButton("Filter"); filterReset.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { vv.getModel().setGraphLayout(layout); } }); JRadioButton filterDirectionInOut = new JRadioButton("In/Out"); filterDirectionInOut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("Dependency Direction: " + EdgeType.IN_OUT); _filterEdgeDirection = EdgeType.IN_OUT; filterLayout = getNewLayout(graph, layout); vv.getModel().setGraphLayout(filterLayout); } }); JRadioButton filterDirectionIn = new JRadioButton("In"); filterDirectionIn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("Dependency Direction: " + EdgeType.IN); _filterEdgeDirection = EdgeType.IN; filterLayout = getNewLayout(graph, layout); vv.getModel().setGraphLayout(filterLayout); } }); JRadioButton filterDirectionOut = new JRadioButton("Out"); filterDirectionOut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("Dependency Direction: " + EdgeType.OUT); _filterEdgeDirection = EdgeType.OUT; filterLayout = getNewLayout(graph, layout); vv.getModel().setGraphLayout(filterLayout); } }); ButtonGroup filterRadios = new ButtonGroup(); filterRadios.add(filterDirectionInOut); filterRadios.add(filterDirectionIn); filterRadios.add(filterDirectionOut); filterRadios.setSelected(filterDirectionInOut.getModel(), true); JComboBox modeBox = graphMouse.getModeComboBox(); modeBox.setSelectedItem(ModalGraphMouse.Mode.PICKING); final JComboBox filterBox = new JComboBox(graph.getVertices().toArray()); filterBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { _filterChoice = filterBox.getSelectedItem().toString(); System.out.println(_filterChoice); filterLayout = getNewLayout(graph, layout); vv.getModel().setGraphLayout(filterLayout); } }); JButton help = new JButton("Help"); help.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { helpDialog.pack(); helpDialog.setVisible(true); } }); JPanel controls = new JPanel(); JPanel modeControls = new JPanel(); modeControls.setBorder(BorderFactory.createTitledBorder("Mouse Mode")); modeControls.add(graphMouse.getModeComboBox()); controls.add(modeControls); JPanel annotationControlPanel = new JPanel(); annotationControlPanel.setBorder(BorderFactory.createTitledBorder("Annotation Controls")); AnnotationControls annotationControls = new AnnotationControls(annotatingPlugin); annotationControlPanel.add(annotationControls.getAnnotationsToolBar()); controls.add(annotationControlPanel); JPanel helpControls = new JPanel(); helpControls.setBorder(BorderFactory.createTitledBorder("Help")); helpControls.add(help); controls.add(helpControls); JPanel filterControls = new JPanel(); filterControls.setBorder(BorderFactory.createTitledBorder("Filter")); filterControls.add(filterBox); filterControls.add(filterDirectionInOut); filterControls.add(filterDirectionIn); filterControls.add(filterDirectionOut); filterControls.add(filterReset); controls.add(filterControls); content.add(panel); content.add(controls, BorderLayout.SOUTH); }
From source file:umontreal.iro.lecuyer.charts.SSJCategorySeriesCollection.java
protected static String detectXColorClassic(Color color) { String retour = null;/*from w w w. ja va 2 s .com*/ int red = color.getRed(); int green = color.getGreen(); int blue = color.getBlue(); // On utilise pas la method Color.equals(Color ) car on ne veut pas tester le parametre de transparence : Alpha if (red == Color.GREEN.getRed() && blue == Color.GREEN.getBlue() && green == Color.GREEN.getGreen()) return "green"; else if (red == Color.RED.getRed() && blue == Color.RED.getBlue() && green == Color.RED.getGreen()) return "red"; else if (red == Color.WHITE.getRed() && blue == Color.WHITE.getBlue() && green == Color.WHITE.getGreen()) return "white"; else if (red == Color.GRAY.getRed() && blue == Color.GRAY.getBlue() && green == Color.GRAY.getGreen()) return "gray"; else if (red == Color.BLACK.getRed() && blue == Color.BLACK.getBlue() && green == Color.BLACK.getGreen()) return "black"; else if (red == Color.YELLOW.getRed() && blue == Color.YELLOW.getBlue() && green == Color.YELLOW.getGreen()) return "yellow"; else if (red == Color.MAGENTA.getRed() && blue == Color.MAGENTA.getBlue() && green == Color.MAGENTA.getGreen()) return "magenta"; else if (red == Color.CYAN.getRed() && blue == Color.CYAN.getBlue() && green == Color.CYAN.getGreen()) return "cyan"; else if (red == Color.BLUE.getRed() && blue == Color.BLUE.getBlue() && green == Color.BLUE.getGreen()) return "blue"; else if (red == Color.DARK_GRAY.getRed() && blue == Color.DARK_GRAY.getBlue() && green == Color.DARK_GRAY.getGreen()) return "darkgray"; else if (red == Color.LIGHT_GRAY.getRed() && blue == Color.LIGHT_GRAY.getBlue() && green == Color.LIGHT_GRAY.getGreen()) return "lightgray"; else if (red == Color.ORANGE.getRed() && blue == Color.ORANGE.getBlue() && green == Color.ORANGE.getGreen()) return "orange"; else if (red == Color.PINK.getRed() && blue == Color.PINK.getBlue() && green == Color.PINK.getGreen()) return "pink"; if (red == 192 && blue == 128 && green == 64) return "brown"; else if (red == 128 && blue == 128 && green == 0) return "olive"; else if (red == 128 && blue == 0 && green == 128) return "violet"; else if (red == 192 && blue == 0 && green == 64) return "purple"; else return null; }
From source file:MyLink.java
public JPanel KSGenerate() { // create a simple graph for the demo graph = new SparseMultigraph<Integer, MyLink>(); Integer[] v = createVertices(getTermNum()); createEdges(v);/* ww w. jav a2s. c om*/ vv = new VisualizationViewer<Integer, MyLink>(new KKLayout<Integer, MyLink>(graph)); //vv.setPreferredSize(new Dimension(540,500)); vv.setPreferredSize(new Dimension(610, 570)); // 570, 640 | 565, 640 | 565, 570 vv.getRenderContext().setVertexLabelTransformer(new UnicodeVertexStringer<Integer>(v)); vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.magenta)); vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.magenta)); VertexIconShapeTransformer<Integer> vertexIconShapeFunction = new VertexIconShapeTransformer<Integer>( new EllipseVertexShapeTransformer<Integer>()); DefaultVertexIconTransformer<Integer> vertexIconFunction = new DefaultVertexIconTransformer<Integer>(); vv.getRenderContext().setVertexShapeTransformer(vertexIconShapeFunction); vv.getRenderContext().setVertexIconTransformer(vertexIconFunction); loadImages(v, vertexIconFunction.getIconMap()); vertexIconShapeFunction.setIconMap(vertexIconFunction.getIconMap()); vv.getRenderContext().setVertexFillPaintTransformer(new PickableVertexPaintTransformer<Integer>( vv.getPickedVertexState(), new Color(0, 102, 255), Color.red)); vv.getRenderContext().setEdgeDrawPaintTransformer( new PickableEdgePaintTransformer<MyLink>(vv.getPickedEdgeState(), Color.orange, Color.cyan)); vv.setBackground(Color.white); final int maxSize = findMaxSizeNumber(); File file = new File("./output/DESC_TERM_COUNT.txt"); String s; try { BufferedReader fis = new BufferedReader(new InputStreamReader(new FileInputStream(file))); s = fis.readLine(); userSelectedTermsCount = Integer.parseInt(s); termIndex = new int[userSelectedTermsCount]; int i = 0; while ((s = fis.readLine()) != null) { String[] tmp = s.split("="); termIndex[i] = Integer.parseInt(tmp[1].trim()); i++; } } catch (IOException e) { System.out.println(e.getMessage()); } Transformer<Integer, Shape> vertexSize = new Transformer<Integer, Shape>() { public Shape transform(Integer i) { double sizeInt = termIndex[i]; sizeInt = (double) sizeInt / (double) maxSize; sizeInt = (double) sizeInt * (double) 30 + 10; Ellipse2D circle = new Ellipse2D.Double(sizeInt / 2 * (-1), sizeInt / 2 * (-1), sizeInt, sizeInt); return circle; } }; vv.getRenderContext().setVertexShapeTransformer(vertexSize); vv.getRenderer().getVertexLabelRenderer().setPosition(Position.N); // add my listener for ToolTips vv.setVertexToolTipTransformer(new ToStringLabeller<Integer>()); // create a frome to hold the graph APanel = new JPanel(); APanel.setLayout(new BoxLayout(APanel, BoxLayout.Y_AXIS)); final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); final ModalGraphMouse gm = new DefaultModalGraphMouse<Integer, Number>(); vv.setGraphMouse(gm); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); JCheckBox lo = new JCheckBox("Show Labels"); lo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { showLabels = e.getStateChange() == ItemEvent.SELECTED; vv.repaint(); } }); lo.setSelected(true); JPanel controls = new JPanel(); controls.add(plus); controls.add(minus); controls.add(lo); controls.add(((DefaultModalGraphMouse<Integer, Number>) gm).getModeComboBox()); vv.setBorder(KSMapBorder); APanel.add(vv); APanel.add(controls); return APanel; }
From source file:pts4.googlemaps.Gmaps.java
public void open() { // Create a TileFactoryInfo for Virtual Earth TileFactoryInfo info = new VirtualEarthTileFactoryInfo(VirtualEarthTileFactoryInfo.MAP); DefaultTileFactory tileFactory = new DefaultTileFactory(info); tileFactory.setThreadPoolSize(8);/* w w w . ja v a 2 s . c o m*/ // Setup local file cache File cacheDir = new File(System.getProperty("user.home") + File.separator + ".jxmapviewer2"); LocalResponseCache.installResponseCache(info.getBaseURL(), cacheDir, false); // Setup JXMapViewer mapViewer = new JXMapViewer(); mapViewer.setTileFactory(tileFactory); //Calimiteiten toevoegen. sa = new SelectionAdapter(mapViewer); sp = new SelectionPainter(sa); waypointPainter = new WaypointPainter<Waypoint>(); waypointPainter2 = new WaypointPainter<MyWaypoint>(); waypointPainter3 = new WaypointPainter<MyWaypoint>(); waypoints = new HashSet<Waypoint>(); units = new HashSet<MyWaypoint>(); orders = new HashSet<MyWaypoint>(); painters = new ArrayList<Painter<JXMapViewer>>(); for (Incident object : incidents) { GeoPosition plek = new GeoPosition(Double.parseDouble(object.getLatitude()), Double.parseDouble(object.getLongitude())); waypoints.add(new DefaultWaypoint(plek)); // Create a waypoint painter that takes all the waypoints } waypointPainter.setWaypoints(waypoints); mapViewer.setOverlayPainter(waypointPainter); for (Unit a : EmergencyUnits) { GeoPosition spot = new GeoPosition(a.getLatidude(), a.getLongitude()); Color color = null; if (a.getType() == 1) { color = Color.cyan; } if (a.getType() == 2) { color = Color.YELLOW; } if (a.getType() == 3) { color = Color.RED; } units.add(new MyWaypoint(a.getName(), color, spot)); // Create a waypoint painter that takes all the waypoints waypointPainter2.setWaypoints(units); waypointPainter2.setRenderer(new FancyWaypointRenderer()); // Create a waypoint painter that takes all the waypoints } createStage(); draw(); /*// Create waypoints from the geo-positions Set<MyWaypoint> waypoints = new HashSet<MyWaypoint>(Arrays.asList( new MyWaypoint("F", Color.ORANGE, Utrecht))); // Create a waypoint painter that takes all the waypoints WaypointPainter<MyWaypoint> waypointPainter = new WaypointPainter<MyWaypoint>(); waypointPainter.setWaypoints(waypoints); waypointPainter.setRenderer(new FancyWaypointRenderer()); mapViewer.setOverlayPainter(waypointPainter);*/ // Display the viewer in a JFrame }
From source file:projekt.CustomRenderer.java
public void raport_lokalny() throws IOException, ClassNotFoundException, SQLException { loginController login = new loginController(); String zapytanie = "select count(*) as Aktualne from projekty, (SELECT Nazwa, Opis, Status_zadania, idUzytkownika,projekt from zadania where Status_zadania = 'Aktualne' and idUzytkownika = '" + login.uzytkownikID + "') x where projekty.Nazwa = x.projekt"; String zapytanie1 = "select count(*) as FORTEST from projekty, (SELECT Nazwa, Opis, Status_zadania, idUzytkownika,projekt from zadania where Status_zadania = 'FORTEST' and idUzytkownika = '" + login.uzytkownikID + "') x where projekty.Nazwa = x.projekt"; String zapytanie2 = "select count(*) as Zakonczone from projekty, (SELECT Nazwa, Opis, Status_zadania, idUzytkownika,projekt from zadania where Status_zadania = 'Zakonczone' and idUzytkownika = '" + login.uzytkownikID + "') x where projekty.Nazwa = x.projekt"; Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/pz?characterEncoding=utf8", "root", ""); PreparedStatement statment;//from www. ja va 2s . c o m ResultSet result; double odp = 0, odp1 = 0, odp2 = 0; statment = con.prepareStatement(zapytanie); result = statment.executeQuery(); if (result.next()) { odp = result.getDouble("Aktualne"); } statment = con.prepareStatement(zapytanie1); result = statment.executeQuery(); if (result.next()) { odp1 = result.getDouble("FORTEST"); } statment = con.prepareStatement(zapytanie2); result = statment.executeQuery(); if (result.next()) { odp2 = result.getDouble("Zakonczone"); } //tu tez zmienic na id statment = con.prepareStatement( "SELECT CONCAT(imie, ' ', nazwisko) as osoba from uzytkownicy WHERE idUzytkownika = '" + login.uzytkownikID + "'"); result = statment.executeQuery(); String bbc = ""; if (result.next()) { bbc = result.getString(1); } DefaultCategoryDataset set2 = new DefaultCategoryDataset(); set2.setValue(odp, "", "Aktualne"); set2.setValue(odp1, "", "FORTEST"); set2.setValue(odp2, "", "Zakonczone"); JFreeChart chart = ChartFactory.createBarChart( "Wszystkie zadania z projektow za ktore odpowiada " + result.getString(1), "Zadania", "Ilosc", set2, PlotOrientation.VERTICAL, false, true, false); final CategoryItemRenderer renderer = new CustomRenderer(new Paint[] { Color.blue, Color.pink, Color.cyan, Color.yellow, Color.orange, Color.cyan, Color.magenta, Color.blue }); final CategoryPlot plot = chart.getCategoryPlot(); plot.setNoDataMessage("NO DATA!"); renderer.setItemLabelsVisible(true); final ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, 45.0); renderer.setPositiveItemLabelPosition(p); plot.setRenderer(renderer); ByteArrayOutputStream out = new ByteArrayOutputStream(); ChartUtilities.writeChartAsJPEG(out, chart, 450, 600); DateFormat dataformat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); DateFormat dataformat1 = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss"); Date data = new Date(); String fileName = "Raport lokalny " + dataformat1.format(data) + ".pdf"; try { PDRectangle PAGE_SIZE = PDRectangle.A4; PDDocument doc = new PDDocument(); PDFont font = PDType0Font.load(doc, getClass().getResourceAsStream("/fonts/RobotoCondensed-Regular.ttf")); PDFont font1 = PDType0Font.load(doc, getClass().getResourceAsStream("/fonts/RobotoCondensed-Bold.ttf")); PDPage page = new PDPage(PAGE_SIZE); PDPage page1 = new PDPage(PAGE_SIZE); doc.addPage(page); PDPageContentStream content = new PDPageContentStream(doc, page); //naglowek strona 1 Naglowek1(content, dataformat, data); //stopka strona1 Stopka(content, doc); content.beginText(); content.setFont(font1, 48); content.moveTextPositionByAmount(135, 550); content.showText("Raport lokalny"); content.endText(); content.beginText(); content.setFont(font, 22); content.moveTextPositionByAmount(30, 250); content.showText("Wersja systemu : 1.0"); content.newLine(); content.moveTextPositionByAmount(0, 35); content.showText("Autor raportu : " + result.getString("osoba")); content.endText(); content.close(); PDPageContentStream content1 = new PDPageContentStream(doc, page1); PDPage page2 = new PDPage(PAGE_SIZE); doc.addPage(page2); PDPageContentStream content2 = new PDPageContentStream(doc, page2); Naglowek1(content2, dataformat, data); //stopka strona2 Stopka(content2, doc); content2.beginText(); content2.setFont(font, 14); content2.moveTextPositionByAmount(30, 775); content2.showText("Wszystkie projekty za ktre odpowiada: " + result.getString(1)); statment = con.prepareStatement( "Select Nazwa, Opis, Poczatek, Koniec, ludzie from projekty where idUzytkownika='" + login.uzytkownikID + "'"); result = statment.executeQuery(); content2.newLine(); int liczba = 615; content2.moveTextPositionByAmount(0, -15); while (result.next()) { content2.newLine(); content2.moveTextPositionByAmount(0, -22); liczba += 22; //content2.showText("Nazwa : "+result.getString("Nazwa")+" Opis: "+result.getString("Opis")+" Data rozpoczecia: "+result.getString("Poczatek")+" Data zakonczenia: "+result.getString("Koniec")); content2.showText("Nazwa : " + result.getString("Nazwa") + " Opis: " + result.getString(1)); content2.newLine(); content2.moveTextPositionByAmount(0, -17); liczba += 22; content2.showText("Data rozpoczecia: " + result.getString("Poczatek") + " Data zakonczenia: " + result.getString("Koniec")); } content2.endText(); // content2.setLineWidth(2); // content2.moveTo(10, liczba + 5); // content2.lineTo(10, liczba +5); // content2.closeAndStroke(); DateFormat dataformat2 = new SimpleDateFormat("yyyy-MM-dd"); statment = con.prepareStatement("Select count(*) as 'Aktualne' from projekty where Koniec > '" + dataformat2.format(data) + "' and idUzytkownika='" + login.uzytkownikID + "'"); result = statment.executeQuery(); int aktualne = 0, zakonczone = 0; if (result.next()) { aktualne = result.getInt("Aktualne"); } statment = con.prepareStatement("Select count(*) as 'Zakonczone' from projekty where Koniec < '" + dataformat2.format(data) + "' and idUzytkownika='" + login.uzytkownikID + "'"); result = statment.executeQuery(); if (result.next()) { zakonczone = result.getInt("Zakonczone"); } DefaultPieDataset pieDataset = new DefaultPieDataset(); pieDataset.setValue("Aktualne", aktualne); pieDataset.setValue("Zakonczone", zakonczone); JFreeChart chart1 = ChartFactory.createPieChart("Zestawienia projekt za ktore odpowiada" + bbc, // Title pieDataset, // Dataset true, // Show legend true, // Use tooltips false // Configure chart to generate URLs? ); PiePlot plot1 = (PiePlot) chart1.getPlot(); plot1.setSectionPaint("Aktualne", Color.blue); plot1.setSectionPaint("Zakonczone", Color.yellow); plot1.setExplodePercent("Aktualne", 0.10); plot1.setSimpleLabels(true); PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator("{0}: {1} ({2})", new DecimalFormat("0"), new DecimalFormat("0%")); plot1.setLabelGenerator(gen); ByteArrayOutputStream out1 = new ByteArrayOutputStream(); ChartUtilities.writeChartAsJPEG(out1, chart1, 450, 600); PDImageXObject img1 = JPEGFactory.createFromStream(doc, new ByteArrayInputStream(out1.toByteArray())); content2.close(); PDPage page3 = new PDPage(PAGE_SIZE); doc.addPage(page3); PDPageContentStream content3 = new PDPageContentStream(doc, page3); Naglowek1(content3, dataformat, data); //stopka strona2 Stopka(content3, doc); content3.drawImage(img1, 50, 50); content3.close(); PDPage page4 = new PDPage(PAGE_SIZE); doc.addPage(page4); PDPageContentStream content4 = new PDPageContentStream(doc, page4); Naglowek1(content4, dataformat, data); //stopka strona2 Stopka(content4, doc); content4.beginText(); content4.setFont(font, 14); content4.moveTextPositionByAmount(30, 780); content4.showText("Wszystkie zadania w projektach za ktore odpowiada:" + bbc); statment = con.prepareStatement( "SELECT zadania.Nazwa,zadania.Opis,zadania.Status_zadania,zadania.projekt, z.Imie, z.Nazwisko,CONCAT(y.imie, ' ' , y.nazwisko) as 'UZY' FROM zadania , (select Nazwa from projekty where idUzytkownika = '" + login.uzytkownikID + "') x, (SELECT imie, nazwisko, idUzytkownika from uzytkownicy) y,(SELECT imie, nazwisko, idUzytkownika from uzytkownicy where idUzytkownika = '" + login.uzytkownikID + "') z WHERE zadania.projekt = x.Nazwa LIMIT 12"); //poprawic result = statment.executeQuery(); content4.newLine(); int nw = 850; content4.moveTextPositionByAmount(0, -15); nw -= 15; while (result.next()) { content4.newLine(); nw -= 22; content4.moveTextPositionByAmount(0, -22); //content2.showText("Nazwa : "+result.getString("Nazwa")+" Opis: "+result.getString("Opis")+" Data rozpoczecia: "+result.getString("Poczatek")+" Data zakonczenia: "+result.getString("Koniec")); content4.showText("Nazwa : " + result.getString("zadania.Nazwa")); content4.newLine(); nw -= 17; content4.moveTextPositionByAmount(0, -17); content4.showText(" Opis: " + result.getString("zadania.Opis") + " Status zadania: " + result.getString("zadania.Status_zadania")); content4.newLine(); nw -= 17; content4.moveTextPositionByAmount(0, -17); content4.showText(" Projekt: " + result.getString("zadania.projekt") + " Przydzielona osoba do zadania: " + result.getString("UZY")); } content4.endText(); content4.close(); statment = con.prepareStatement( "SELECT count(*) as 'liczba' FROM `zadania` where idUzytkownika='" + login.uzytkownikID + "'"); //poprawic result = statment.executeQuery(); if (result.next()) { } statment = con.prepareStatement( "SELECT zadania.Nazwa,zadania.Opis,zadania.Status_zadania,zadania.projekt, z.Imie, z.Nazwisko,CONCAT(y.imie, \" \", y.nazwisko) as \"UZY\" FROM zadania , (select Nazwa from projekty where idUzytkownika = '" + login.uzytkownikID + "') x, (SELECT imie, nazwisko, idUzytkownika from uzytkownicy) y,(SELECT imie, nazwisko, idUzytkownika from uzytkownicy where idUzytkownika = '" + login.uzytkownikID + "') z WHERE zadania.projekt = x.Nazwa LIMIT 12," + result.getInt(1) + ""); result = statment.executeQuery(); PDPage page5 = new PDPage(PAGE_SIZE); doc.addPage(page5); PDPageContentStream content5 = new PDPageContentStream(doc, page5); Naglowek1(content5, dataformat, data); //stopka strona2 Stopka(content5, doc); content5.beginText(); content5.setFont(font, 14); content5.moveTextPositionByAmount(30, 700); while (result.next()) { content5.newLine(); nw -= 22; content5.moveTextPositionByAmount(0, -22); //content2.showText("Nazwa : "+result.getString("Nazwa")+" Opis: "+result.getString("Opis")+" Data rozpoczecia: "+result.getString("Poczatek")+" Data zakonczenia: "+result.getString("Koniec")); content5.showText("Nazwa : " + result.getString("zadania.Nazwa")); content5.newLine(); nw -= 17; content5.moveTextPositionByAmount(0, -17); content5.showText(" Opis: " + result.getString("zadania.Opis") + " Status zadania: " + result.getString("zadania.Status_zadania")); content5.newLine(); nw -= 17; content5.moveTextPositionByAmount(0, -17); content5.showText(" Projekt: " + result.getString("zadania.projekt") + " Przydzielona osoba do zadania: " + result.getString("UZY")); } content5.endText(); content5.close(); doc.addPage(page1); //naglowek strona 2 Naglowek1(content1, dataformat, data); //stopka strona2 Stopka(content1, doc); PDImageXObject img = JPEGFactory.createFromStream(doc, new ByteArrayInputStream(out.toByteArray())); content1.drawImage(img, 50, 50); content1.close(); doc.save(fileName); doc.close(); } catch (Exception e) { System.err.println(e.getMessage()); } }
From source file:org.polymap.core.style.geotools.DefaultStyles.java
/** * Create a Style to draw point features as circles with blue outlines * and cyan fill/*from w ww .j a va2 s .c om*/ */ private Style createPointStyle(Style style) { Graphic gr = styleFactory.createDefaultGraphic(); Mark mark = styleFactory.getCircleMark(); mark.setStroke(styleFactory.createStroke(filterFactory.literal(Color.BLUE), filterFactory.literal(1))); mark.setFill(styleFactory.createFill(filterFactory.literal(Color.CYAN))); gr.graphicalSymbols().clear(); gr.graphicalSymbols().add(mark); gr.setSize(filterFactory.literal(5)); /* * Setting the geometryPropertyName arg to null signals that we want to * draw the default geometry of features */ PointSymbolizer sym = styleFactory.createPointSymbolizer(gr, null); Rule rule = styleFactory.createRule(); rule.symbolizers().add(sym); rule.setName("Rule for PointSymbolizer"); style.featureTypeStyles().get(0).rules().add(rule); return style; }
From source file:test.visualization.ClusteringDemo.java
private void setUpView(BufferedReader br) throws IOException { Factory<Number> vertexFactory = new Factory<Number>() { int n = 0; public Number create() { return n++; }// w w w .ja v a2 s .c om }; Factory<Number> edgeFactory = new Factory<Number>() { int n = 0; public Number create() { return n++; } }; PajekNetReader<Graph<Number, Number>, Number, Number> pnr = new PajekNetReader<Graph<Number, Number>, Number, Number>( vertexFactory, edgeFactory); final Graph<Number, Number> graph = new SparseMultigraph<Number, Number>(); pnr.load(br, graph); //Create a simple layout frame //specify the Fruchterman-Rheingold layout algorithm final AggregateLayout<Number, Number> layout = new AggregateLayout<Number, Number>( new FRLayout<Number, Number>(graph)); vv = new VisualizationViewer<Number, Number>(layout); vv.setBackground(Color.white); //Tell the renderer to use our own customized color rendering vv.getRenderContext() .setVertexFillPaintTransformer(MapTransformer.<Number, Paint>getInstance(vertexPaints)); vv.getRenderContext().setVertexDrawPaintTransformer(new Transformer<Number, Paint>() { public Paint transform(Number v) { if (vv.getPickedVertexState().isPicked(v)) { return Color.cyan; } else { 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("Restart"); scramble.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { Layout layout = vv.getGraphLayout(); layout.initialize(); Relaxer relaxer = vv.getModel().getRelaxer(); if (relaxer != null) { relaxer.stop(); relaxer.prerelax(); relaxer.relax(); } } }); DefaultModalGraphMouse gm = new DefaultModalGraphMouse(); vv.setGraphMouse(gm); final JToggleButton 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(210, 50)); edgeBetweennessSlider.setPaintTicks(true); edgeBetweennessSlider.setMaximum(graph.getEdgeCount()); edgeBetweennessSlider.setMinimum(0); edgeBetweennessSlider.setValue(0); edgeBetweennessSlider.setMajorTickSpacing(10); edgeBetweennessSlider.setPaintLabels(true); edgeBetweennessSlider.setPaintTicks(true); // edgeBetweennessSlider.setBorder(BorderFactory.createLineBorder(Color.black)); //TO DO: edgeBetweennessSlider.add(new JLabel("Node Size (PageRank With Priors):")); //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(eastSize); eastControls.add(Box.createVerticalGlue()); groupVertices.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { clusterAndRecolor(layout, edgeBetweennessSlider.getValue(), similarColors, e.getStateChange() == ItemEvent.SELECTED); vv.repaint(); } }); clusterAndRecolor(layout, 0, similarColors, groupVertices.isSelected()); 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(); } } }); Container content = getContentPane(); content.add(new GraphZoomScrollPane(vv)); 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); content.add(south, BorderLayout.SOUTH); }
From source file:com.google.code.facebook.graph.sna.applet.LensDemo.java
/** * create an instance of a simple graph with controls to * demo the zoomand hyperbolic features. * /*w w w .ja v a 2 s .com*/ */ public LensDemo() { // create a simple graph for the demo graph = TestGraphs.getOneComponentGraph(); graphLayout = new FRLayout<String, Number>(graph); ((FRLayout) graphLayout).setMaxIterations(1000); Dimension preferredSize = new Dimension(600, 600); Map<String, Point2D> map = new HashMap<String, Point2D>(); Transformer<String, Point2D> vlf = TransformerUtils.mapTransformer(map); grid = this.generateVertexGrid(map, preferredSize, 25); gridLayout = new StaticLayout<String, Number>(grid, vlf, preferredSize); final VisualizationModel<String, Number> visualizationModel = new DefaultVisualizationModel<String, Number>( graphLayout, preferredSize); vv = new VisualizationViewer<String, Number>(visualizationModel, preferredSize); PickedState<String> ps = vv.getPickedVertexState(); PickedState<Number> pes = vv.getPickedEdgeState(); vv.getRenderContext().setVertexFillPaintTransformer( new PickableVertexPaintTransformer<String>(ps, Color.red, Color.yellow)); vv.getRenderContext().setEdgeDrawPaintTransformer( new PickableEdgePaintTransformer<Number>(pes, Color.black, Color.cyan)); vv.setBackground(Color.white); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller()); final Transformer<String, Shape> ovals = vv.getRenderContext().getVertexShapeTransformer(); final Transformer<String, Shape> squares = new ConstantTransformer(new Rectangle2D.Float(-10, -10, 20, 20)); // add a listener for ToolTips vv.setVertexToolTipTransformer(new ToStringLabeller()); Container content = getContentPane(); GraphZoomScrollPane gzsp = new GraphZoomScrollPane(vv); content.add(gzsp); /** * the regular graph mouse for the normal view */ final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse(); vv.setGraphMouse(graphMouse); vv.addKeyListener(graphMouse.getModeKeyListener()); hyperbolicViewSupport = new ViewLensSupport<String, Number>(vv, new HyperbolicShapeTransformer(vv, vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW)), new ModalLensGraphMouse()); hyperbolicLayoutSupport = new LayoutLensSupport<String, Number>(vv, new HyperbolicTransformer(vv, vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT)), new ModalLensGraphMouse()); magnifyViewSupport = new ViewLensSupport<String, Number>(vv, new MagnifyShapeTransformer(vv, vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW)), new ModalLensGraphMouse(new LensMagnificationGraphMousePlugin(1.f, 6.f, .2f))); magnifyLayoutSupport = new LayoutLensSupport<String, Number>(vv, new MagnifyTransformer(vv, vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT)), new ModalLensGraphMouse(new LensMagnificationGraphMousePlugin(1.f, 6.f, .2f))); hyperbolicLayoutSupport.getLensTransformer() .setLensShape(hyperbolicViewSupport.getLensTransformer().getLensShape()); magnifyViewSupport.getLensTransformer() .setLensShape(hyperbolicLayoutSupport.getLensTransformer().getLensShape()); magnifyLayoutSupport.getLensTransformer() .setLensShape(magnifyViewSupport.getLensTransformer().getLensShape()); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); ButtonGroup radio = new ButtonGroup(); JRadioButton normal = new JRadioButton("None"); normal.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { if (hyperbolicViewSupport != null) { hyperbolicViewSupport.deactivate(); } if (hyperbolicLayoutSupport != null) { hyperbolicLayoutSupport.deactivate(); } if (magnifyViewSupport != null) { magnifyViewSupport.deactivate(); } if (magnifyLayoutSupport != null) { magnifyLayoutSupport.deactivate(); } } } }); final JRadioButton hyperView = new JRadioButton("Hyperbolic View"); hyperView.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { hyperbolicViewSupport.activate(e.getStateChange() == ItemEvent.SELECTED); } }); final JRadioButton hyperModel = new JRadioButton("Hyperbolic Layout"); hyperModel.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { hyperbolicLayoutSupport.activate(e.getStateChange() == ItemEvent.SELECTED); } }); final JRadioButton magnifyView = new JRadioButton("Magnified View"); magnifyView.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { magnifyViewSupport.activate(e.getStateChange() == ItemEvent.SELECTED); } }); final JRadioButton magnifyModel = new JRadioButton("Magnified Layout"); magnifyModel.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { magnifyLayoutSupport.activate(e.getStateChange() == ItemEvent.SELECTED); } }); JLabel modeLabel = new JLabel(" Mode Menu >>"); modeLabel.setUI(new VerticalLabelUI(false)); radio.add(normal); radio.add(hyperModel); radio.add(hyperView); radio.add(magnifyModel); radio.add(magnifyView); normal.setSelected(true); graphMouse.addItemListener(hyperbolicLayoutSupport.getGraphMouse().getModeListener()); graphMouse.addItemListener(hyperbolicViewSupport.getGraphMouse().getModeListener()); graphMouse.addItemListener(magnifyLayoutSupport.getGraphMouse().getModeListener()); graphMouse.addItemListener(magnifyViewSupport.getGraphMouse().getModeListener()); ButtonGroup graphRadio = new ButtonGroup(); JRadioButton graphButton = new JRadioButton("Graph"); graphButton.setSelected(true); graphButton.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { visualizationModel.setGraphLayout(graphLayout); vv.getRenderContext().setVertexShapeTransformer(ovals); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller()); vv.repaint(); } } }); JRadioButton gridButton = new JRadioButton("Grid"); gridButton.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { visualizationModel.setGraphLayout(gridLayout); vv.getRenderContext().setVertexShapeTransformer(squares); vv.getRenderContext().setVertexLabelTransformer(new ConstantTransformer(null)); vv.repaint(); } } }); graphRadio.add(graphButton); graphRadio.add(gridButton); JPanel modePanel = new JPanel(new GridLayout(3, 1)); modePanel.setBorder(BorderFactory.createTitledBorder("Display")); modePanel.add(graphButton); modePanel.add(gridButton); JMenuBar menubar = new JMenuBar(); menubar.add(graphMouse.getModeMenu()); gzsp.setCorner(menubar); Box controls = Box.createHorizontalBox(); JPanel zoomControls = new JPanel(new GridLayout(2, 1)); zoomControls.setBorder(BorderFactory.createTitledBorder("Zoom")); JPanel hyperControls = new JPanel(new GridLayout(3, 2)); hyperControls.setBorder(BorderFactory.createTitledBorder("Examiner Lens")); zoomControls.add(plus); zoomControls.add(minus); hyperControls.add(normal); hyperControls.add(new JLabel()); hyperControls.add(hyperModel); hyperControls.add(magnifyModel); hyperControls.add(hyperView); hyperControls.add(magnifyView); controls.add(zoomControls); controls.add(hyperControls); controls.add(modePanel); controls.add(modeLabel); content.add(controls, BorderLayout.SOUTH); }