List of usage examples for java.awt Frame getIconImage
public Image getIconImage()
From source file:Main.java
/** * Finds frames with an icon: Frames of {@code Frame#getFrames()} where * {@code Frame#getIconImage()} returns not null. * * @return frames with an icon or an empty list *///from ww w . ja v a 2 s . com public static List<Frame> findFramesWithIcons() { List<Frame> frames = new ArrayList<>(); Frame[] allFrames = Frame.getFrames(); for (Frame frame : allFrames) { if (frame.getIconImage() != null) { frames.add(frame); } } return frames; }
From source file:org.yccheok.jstock.gui.charting.ChartJDialog.java
/** Creates new form ChartJDialog */ public ChartJDialog(java.awt.Frame parent, String title, boolean modalNotUsed, StockHistoryServer stockHistoryServer) { super(title); this.parent = parent; this.parent.addWindowListener(this); this.setIconImage(parent.getIconImage()); initComponents();//from w w w. j a v a 2 s. c o m initKeyBindings(); // Must initialized first before any other operations. Our objective // is to show this chart as fast as possible. Hence, we will pass in // null first, till we sure what are we going to create. this.chartPanel = new ChartPanel(null, true, true, true, true, true); this.stockHistoryServer = stockHistoryServer; final ChartJDialogOptions chartJDialogOptions = JStock.instance().getChartJDialogOptions(); this.changeInterval(chartJDialogOptions.getInterval()); // Yellow box and chart resizing (#2969416) // // paradoxoff : // If the available size for a ChartPanel exceeds the dimensions defined // by the maximumDrawWidth and maximumDrawHeight attributes, the // ChartPanel will draw the chart in a Rectangle defined by the maximum // sizes and then scale it to fill the available size. // All you need to do is to avoid that scaling by using sufficiently // large values for the maximumDrawWidth and maximumDrawHeight, e. g. // by using the Dimension returned from // Toolkit.getDefaultToolkit().getScreenSize() // http://www.jfree.org/phpBB2/viewtopic.php?f=3&t=30059 final Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); this.chartPanel.setMaximumDrawWidth((int) Math.round(dimension.getWidth())); this.chartPanel.setMaximumDrawHeight((int) Math.round(dimension.getHeight())); // Make chartPanel able to receive key event. // So that we may use arrow key to move around yellow information box. this.chartPanel.setFocusable(true); this.chartPanel.requestFocus(); final org.jdesktop.jxlayer.JXLayer<ChartPanel> layer = new org.jdesktop.jxlayer.JXLayer<ChartPanel>( this.chartPanel); this.chartLayerUI = new ChartLayerUI<ChartPanel>(this); layer.setUI(this.chartLayerUI); // Call after JXLayer has been initialized. changeType assumes JXLayer // is ready. this.changeType(chartJDialogOptions.getType()); getContentPane().add(layer, java.awt.BorderLayout.CENTER); // Handle resize. this.addComponentListener(new java.awt.event.ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { ChartJDialog.this.chartLayerUI.updateTraceInfos(); } }); // Update GUI. if (JStock.instance().getJStockOptions().getChartTheme() == JStockOptions.ChartTheme.Light) { this.jRadioButtonMenuItem3.setSelected(true); } else { this.jRadioButtonMenuItem4.setSelected(true); } }
From source file:org.yccheok.jstock.gui.news.StockNewsJFrame.java
public StockNewsJFrame(java.awt.Frame parent, StockInfo stockInfo, String title) { super(title); this.parent = parent; this.parent.addWindowListener(this); this.setIconImage(parent.getIconImage()); this.stockInfo = stockInfo; final Country country = org.yccheok.jstock.engine.Utils.toCountry(this.stockInfo.code); this.newsServers = NewsServerFactory.getNewsServers(country); fullSize = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); sceneWidth = fullSize.width / 2;//from w ww . j a v a2 s . c o m sceneHeight = fullSize.height; this.setSize((int) sceneWidth, (int) sceneHeight); initComponents(); }