List of usage examples for java.awt Container setVisible
public void setVisible(boolean b)
From source file:com.fisher.mainFrame.java
private void startButtonActionPerformed(ActionEvent e) { // TODO add your code here this.logger.log("starting the application"); this.handler = new DataHandler(fileLogger); // kick start the connection in the DataHandler constructor // Create and attach chart panel this.plotter = new BotDataPlotter(); this.handler.setPlotter(this.plotter); this.plotter.setKalmanTickSource(this.handler.m_kalmanBot.m_midTicks); this.plotter.setKalmanOutputSource(this.handler.m_kalmanBot.m_output); this.plotter.setKalmanSignalSource(this.handler.m_kalmanBot.m_kFilter.buySellSignal); this.chart = plotter.createKalmanChart(); this.plotter.customizeChart(); this.chartPanel = new ChartPanel(this.chart); this.plotScrollPane = new JScrollPane(); this.plotScrollPane.add(chartPanel); this.plotScrollPane.setViewportView(chartPanel); Container pane = this.getContentPane(); pane.add(this.plotScrollPane, BorderLayout.SOUTH); this.plotScrollPane.setVisible(true); pane.setVisible(false); pane.setVisible(true);//from w w w . jav a 2 s . c om this.startButton.setEnabled(false); this.stopButton.setEnabled(true); }
From source file:sim.app.sugarscape.util.ResultsGrapher.java
public void buildGraphics(XYSeries[] series) { JFrame j = new JFrame("Results for " + resultsfile); j.setSize(800, 1000);//from w w w . j a v a 2s . c o m Container cp = j.getContentPane(); ChartPanel c1 = new ChartPanel(this.createChart1(series)); JFreeChart c = c1.getChart(); //3 lines below for version .92. Not sure how to do in 1.0.1 yet. //StandardLegend legend = (StandardLegend)c.getLegend(); //legend.setDisplaySeriesLines(true); //legend.setDisplaySeriesShapes(true); cp.add(c1); cp.setVisible(true); j.pack(); j.setVisible(true); //j.getContentPane(). }
From source file:net.panthema.BispanningGame.GamePanel.java
public void writePdf() throws FileNotFoundException, DocumentException { // Query user for filename JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle("Specify PDF file to save"); chooser.setCurrentDirectory(new File(".")); FileNameExtensionFilter filter = new FileNameExtensionFilter("PDF Documents", "pdf"); chooser.setFileFilter(filter);/*w w w. j a va2 s . c om*/ if (chooser.showSaveDialog(this) != JFileChooser.APPROVE_OPTION) return; File outfile = chooser.getSelectedFile(); if (!outfile.getAbsolutePath().endsWith(".pdf")) { outfile = new File(outfile.getAbsolutePath() + ".pdf"); } // Calculate page size rectangle Dimension size = mVV.getSize(); Rectangle rsize = new Rectangle(size.width, size.height); // Open the PDF file for writing - and create a Graphics2D object Document document = new Document(rsize); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(outfile)); document.open(); PdfContentByte contentByte = writer.getDirectContent(); PdfGraphics2D graphics2d = new PdfGraphics2D(contentByte, size.width, size.height, new DefaultFontMapper()); // Create a container to hold the visualization Container container = new Container(); container.addNotify(); container.add(mVV); container.setVisible(true); container.paintComponents(graphics2d); // Dispose of the graphics and close the document graphics2d.dispose(); document.close(); // Put mVV back onto visible plane setLayout(new BorderLayout()); add(mVV, BorderLayout.CENTER); }
From source file:com.schnee.tweetgeister.visualization.TweetgeisterBalloonLayout.java
private void writeGraph() { Container c = new Container(); VisualizationViewer<Node, Integer> vv = new VisualizationViewer<Node, Integer>(balloonLayout, new Dimension(3000, 3000)); vv.setBackground(Color.white); vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line()); vv.getRenderContext().setVertexLabelTransformer(new TopicNodeLabeller(graph)); vv.getRenderContext().setVertexIncludePredicate(new VertexDisplayPredicate(false)); // add a listener for ToolTips vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray)); //vv.addPreRenderPaintable(rings); vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.AUTO); rings = new Rings(balloonLayout, vv); vv.addPreRenderPaintable(rings);/*from w w w . j a v a2 s . co m*/ java.awt.image.BufferedImage bi = new java.awt.image.BufferedImage(3000, 3000, java.awt.image.BufferedImage.TYPE_INT_RGB); Graphics2D gr = bi.createGraphics(); // MOST-IMPORTANT vv.setSize(3000, 3000); final ScalingControl scaler = new CrossoverScalingControl(); vv.scaleToLayout(scaler); // MOST-IMPORTANT c.addNotify(); c.add(vv); c.setVisible(true); c.paintComponents(gr); try { ImageIO.write(bi, "png", new File("vis.png")); System.out.println("done"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:lcmc.LCMC.java
/** Create the GUI and show it. */ protected static void createAndShowGUI(final Container mainFrame) { final java.util.List<Object> buttonGradient = Arrays.asList(new Object[] { new Float(.3f), new Float(0f), new ColorUIResource(ClusterBrowser.PANEL_BACKGROUND), new ColorUIResource(0xFFFFFF), new ColorUIResource(ClusterBrowser.BUTTON_PANEL_BACKGROUND) }); final java.util.List<Object> checkboxGradient = Arrays.asList( new Object[] { new Float(.3f), new Float(0f), new ColorUIResource(ClusterBrowser.PANEL_BACKGROUND), new ColorUIResource(ClusterBrowser.PANEL_BACKGROUND), new ColorUIResource(0xFFFFFF) }); ToolTipManager.sharedInstance().setInitialDelay(TOOLTIP_INITIAL_DELAY); ToolTipManager.sharedInstance().setDismissDelay(TOOLTIP_DISMISS_DELAY); UIManager.put("TableHeader.background", Tools.getDefaultColor("DrbdMC.TableHeader")); UIManager.put("TableHeader.font", UIManager.getFont("Label.font")); UIManager.put("Button.gradient", buttonGradient); UIManager.put("Button.select", ClusterBrowser.PANEL_BACKGROUND); UIManager.put("CheckBox.gradient", checkboxGradient); UIManager.put("CheckBoxMenuItem.gradient", checkboxGradient); UIManager.put("RadioButton.gradient", checkboxGradient); UIManager.put("RadioButton.rollover", Boolean.TRUE); UIManager.put("RadioButtonMenuItem.gradient", checkboxGradient); UIManager.put("ScrollBar.gradient", buttonGradient); UIManager.put("ToggleButton.gradient", buttonGradient); UIManager.put("Menu.selectionBackground", ClusterBrowser.BUTTON_PANEL_BACKGROUND); UIManager.put("MenuItem.selectionBackground", ClusterBrowser.BUTTON_PANEL_BACKGROUND); UIManager.put("List.selectionBackground", ClusterBrowser.BUTTON_PANEL_BACKGROUND); UIManager.put("ComboBox.selectionBackground", ClusterBrowser.BUTTON_PANEL_BACKGROUND); UIManager.put("OptionPane.background", ClusterBrowser.BUTTON_PANEL_BACKGROUND); UIManager.put("Panel.background", ClusterBrowser.PANEL_BACKGROUND); /* Create and set up the window. */ Tools.getGUIData().setMainFrame(mainFrame); /* Display the window. */ mainFrame.setSize(Tools.getDefaultInt("DrbdMC.width"), Tools.getDefaultInt("DrbdMC.height")); mainFrame.setVisible(true); }
From source file:org.spiderplan.tools.visulization.GraphFrame.java
/** * @param graph/*from w w w . j a va 2s . co m*/ * @param history optional history of the graph * @param title * @param lC the layout * @param edgeLabels map from edges to string labels * @param w width of the window * @param h height of the window */ @SuppressWarnings({ "rawtypes", "unchecked" }) public GraphFrame(AbstractTypedGraph<V, E> graph, Vector<AbstractTypedGraph<V, E>> history, String title, LayoutClass lC, Map<E, String> edgeLabels, int w, int h) { super(title); this.edgeLabels = edgeLabels; this.g = new ObservableGraph<V, E>(graph); this.g.addGraphEventListener(this); this.defaultEdgeType = this.g.getDefaultEdgeType(); this.layoutClass = lC; this.history = history; this.setLayout(lC); layout.setSize(new Dimension(w, h)); try { Relaxer relaxer = new VisRunner((IterativeContext) layout); relaxer.stop(); relaxer.prerelax(); } catch (java.lang.ClassCastException e) { } // Layout<V,E> staticLayout = new StaticLayout<V,E>(g, layout); // Layout<V,E> staticLayout = new SpringLayout<V, E>(g); vv = new VisualizationViewer<V, E>(layout, new Dimension(w, h)); JRootPane rp = this.getRootPane(); rp.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE); getContentPane().setLayout(new BorderLayout()); getContentPane().setBackground(java.awt.Color.lightGray); getContentPane().setFont(new Font("Serif", Font.PLAIN, 10)); vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.S); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<V>()); vv.setForeground(Color.black); graphMouse = new EditingModalGraphMouse<V, E>(vv.getRenderContext(), null, null); graphMouse.setMode(ModalGraphMouse.Mode.PICKING); vv.setGraphMouse(graphMouse); vv.addKeyListener(graphMouse.getModeKeyListener()); // vv.getRenderContext().setEd vv.getRenderContext().setEdgeLabelTransformer(this); vv.getRenderContext().setEdgeDrawPaintTransformer( new PickableEdgePaintTransformer<E>(vv.getPickedEdgeState(), Color.black, Color.cyan)); vv.addComponentListener(new ComponentAdapter() { /** * @see java.awt.event.ComponentAdapter#componentResized(java.awt.event.ComponentEvent) */ @Override public void componentResized(ComponentEvent arg0) { super.componentResized(arg0); layout.setSize(arg0.getComponent().getSize()); } }); getContentPane().add(vv); /** * Create simple container for stuff on SOUTH border of this JFrame */ Container c = new Container(); c.setLayout(new FlowLayout()); c.setBackground(java.awt.Color.lightGray); c.setFont(new Font("Serif", Font.PLAIN, 10)); /** * Button to dump jpeg */ dumpJPEG = new JButton("Dump"); dumpJPEG.addActionListener(this); dumpJPEG.setName("Dump"); c.add(dumpJPEG); /** * Button that creates offspring frame for selected vertices */ subGraphButton = new JButton("Subgraph"); subGraphButton.addActionListener(this); subGraphButton.setName("Subgraph"); c.add(subGraphButton); subGraphDepthLabel = new JLabel("Depth"); c.add(subGraphDepthLabel); subGraphDepth = new JTextField("0", 2); subGraphDepth.setHorizontalAlignment(SwingConstants.CENTER); subGraphDepth.setToolTipText("Depth of sub-graph created from selected nodes."); c.add(subGraphDepth); /** * Button that switches mouse mode */ switchMode = new JButton("Transformation"); switchMode.addActionListener(this); switchMode.setName("SwitchMode"); c.add(switchMode); /** * ComboBox for Layout selection: */ JComboBox layoutList; if (graph instanceof Forest) { String[] layoutStrings = { "Static", "Circle", "DAG", "Spring", "Spring2", "FR", "FR2", "Baloon", "ISOM", "KK", "PolarPoint", "RadialTree", "Tree" }; layoutList = new JComboBox(layoutStrings); } else { String[] layoutStrings = { "Static", "Circle", "DAG", "Spring", "Spring2", "FR", "FR2", "ISOM", "KK", "PolarPoint" }; layoutList = new JComboBox(layoutStrings); } layoutList.setSelectedIndex(5); layoutList.addActionListener(this); layoutList.setName("SelectLayout"); c.add(layoutList); /** * Add container to layout */ c.setVisible(true); getContentPane().add(c, BorderLayout.SOUTH); /** * Setup history scroll bar */ if (history != null) { historySlider = new JSlider(0, history.size() - 1, history.size() - 1); historySlider.addChangeListener(this); historySlider.setMajorTickSpacing(10); historySlider.setMinorTickSpacing(1); historySlider.setPaintTicks(true); historySlider.setPaintLabels(true); historySlider.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); Font font = new Font("Serif", Font.ITALIC, 15); historySlider.setFont(font); getContentPane().add(historySlider, BorderLayout.NORTH); } this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.pack(); this.setVisible(true); }