List of usage examples for java.awt Toolkit getDefaultToolkit
public static synchronized Toolkit getDefaultToolkit()
From source file:MainProgram.MainProgram.java
public MainFrame() throws InterruptedException { super("Registration automator"); setLayout(new FlowLayout()); MainFrameProgram MainFrame = new MainFrameProgram(); setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("power-icon.png"))); MainFrame.setPreferredSize(new Dimension(420, 215)); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); setLocation(dim.width - this.getSize().width - 1250, dim.height / 5 - this.getSize().height); add(MainFrame);//from w ww . ja v a 2 s . co m logFrameInitializer(); }
From source file:Main.java
/** * Computes the maximum bounds of the current screen device. If this method is * called on JDK 1.4, Xinerama-aware results are returned. (See Sun-Bug-ID * 4463949 for details)./* w w w . j a v a 2 s .c om*/ * * @return the maximum bounds of the current screen. */ public static Rectangle getMaximumWindowBounds() { final GraphicsEnvironment localGraphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment(); try { final Method method = GraphicsEnvironment.class.getMethod("getMaximumWindowBounds", (Class[]) null); return (Rectangle) method.invoke(localGraphicsEnvironment, (Object[]) null); } catch (Exception e) { // ignore ... will fail if this is not a JDK 1.4 .. } final Dimension s = Toolkit.getDefaultToolkit().getScreenSize(); return new Rectangle(0, 0, s.width, s.height); }
From source file:com.puzzle.gui.MainFrame.java
/** * Creates new form MainFrame//w w w.j a va2 s. c om */ public MainFrame() { initComponents(); setIconImage(Toolkit.getDefaultToolkit().getImage(MainFrame.class.getResource("/images/flag.png"))); jLabel1.setText(""); jLabel2.setText(""); jLabel5.setText(""); jLabel4.setText(""); makeJtableFace(jTable1); makeJtableFace(jTable2); makeJtableFace(jTable3); makeJtableFace(jTable4); this.setLocationRelativeTo(null); jButton1.setUI(new BEButtonUI().setNormalColor(BEButtonUI.NormalColor.lightBlue)); jButton2.setUI(new BEButtonUI().setNormalColor(BEButtonUI.NormalColor.lightBlue)); this.jDialog1.setSize(600, 480); this.jDialog1.setTitle("title"); this.jDialog2.setSize(800, 540); this.jDialog2.setIconImage(Toolkit.getDefaultToolkit().getImage("")); this.jDialog1.setIconImage(Toolkit.getDefaultToolkit().getImage("")); jDialog1.setLocationRelativeTo(this); jDialog2.setLocationRelativeTo(this); jLabel6.setVisible(false); this.jDialog1.setVisible(false); tray(); }
From source file:jhplot.gui.GHPanel.java
/** * Create a panel with graphics. By default, all margins have size of 10 * pixels. Background color is white. Initialization of JHPLot classes are * done here./*from ww w. j av a2 s . co m*/ * * @param Width * in pixels * @param Height * in pixels */ public GHPanel(int Width, int Height) { System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog"); CanvasPanel = new JPanel(); // build export file tipes // list = new List<ExportFileType>(); // List<ExportFileType> list = ExportFileType.getExportFileTypes(); // addAllExportFileTypes(); this.Width = Width; this.Height = Height; // what if the screen size is smaller? Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int Sheight = screenSize.height; int Swidth = screenSize.width; if (Swidth < this.Width || Sheight < this.Height) { this.Width = (int) (0.5 * Swidth); this.Height = (int) (0.5 * Sheight); } CanvasPanel.addComponentListener(this); CanvasPanel.setPreferredSize(new Dimension(Width, Height)); CanvasPanel.setMinimumSize(new Dimension(20, 20)); leftSize = (int) (Width * 0.025); rightSize = (int) (Width * 0.025); bottomSize = (int) (Height * 0.025); topSize = (int) (Height * 0.025); backMargin = Color.white; mainPanel = new JPanel(); topPanel = new GHMargin(this, "Top"); // left panel topPanel.setGBackground(backMargin); topPanel.setGRecBackground(backMargin); leftPanel = new GHMargin(this, "Left"); // left panel leftPanel.setGBackground(backMargin); leftPanel.setGRecBackground(backMargin); rightPanel = new GHMargin(this, "Right"); // right panel rightPanel.setGBackground(backMargin); rightPanel.setGRecBackground(backMargin); bottomPanel = new GHMargin(this, "Bottom"); // buttom panel bottomPanel.setGBackground(backMargin); rightPanel.setGRecBackground(backMargin); leftPanel.setSizeMargin(leftSize, Height); rightPanel.setSizeMargin(rightSize, Height); bottomPanel.setSizeMargin(Width, bottomSize); topPanel.setSizeMargin(Width, topSize); // invert to GridLayout(); Gaps are zero mainPanel.setBackground(Color.white); mainPanel.setBorder(BorderFactory.createEmptyBorder()); CanvasPanel.setLayout(new BorderLayout()); CanvasPanel.add(mainPanel, BorderLayout.CENTER); CanvasPanel.add(leftPanel, BorderLayout.WEST); CanvasPanel.add(rightPanel, BorderLayout.EAST); CanvasPanel.add(bottomPanel, BorderLayout.SOUTH); CanvasPanel.add(topPanel, BorderLayout.NORTH); // no boarder CanvasPanel.setBorder(BorderFactory.createEmptyBorder()); // initialisation JHPlot.init(); }
From source file:edu.harvard.mcz.imagecapture.LoginDialog.java
/** * This method initializes this//from w ww . j a v a 2 s .c om * */ private void initialize() { this.setContentPane(getJPanel()); this.setTitle("DataShot Login Dialog: Configured For: " + Singleton.getSingletonInstance().getProperties() .getProperties().getProperty(ImageCaptureProperties.KEY_COLLECTION)); URL iconFile = this.getClass().getResource("/edu/harvard/mcz/imagecapture/resources/icon.png"); try { setIconImage(new ImageIcon(iconFile).getImage()); } catch (Exception e) { log.error(e); } if (Singleton.getSingletonInstance().getProperties().getProperties() .getProperty(ImageCaptureProperties.KEY_LOGIN_SHOW_ADVANCED).equalsIgnoreCase("false")) { jPanelAdvanced.setVisible(false); this.setSize(new Dimension(698, 190)); } else { jPanelAdvanced.setVisible(true); this.setSize(new Dimension(698, 290)); } this.getRootPane().setDefaultButton(jButtonLogin); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); this.setLocation((screenSize.width - this.getWidth()) / 2, (screenSize.height - this.getHeight()) / 2); }
From source file:com.clough.android.adbv.view.MainFrame.java
public MainFrame() { initComponents();/*from ww w . j a v a2 s . c o m*/ setIconImage(ValueHolder.Icons.APPLICATION.getImage()); setExtendedState(JFrame.MAXIMIZED_BOTH); Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); double windowWidth = screenDimension.getWidth(); double windowHeight = screenDimension.getHeight(); int frameWidth = (int) (windowWidth * (3d / 4d)); int frameHeight = (int) (windowHeight * (3d / 4d)); setMinimumSize(new Dimension(frameWidth, frameHeight)); setLocation((int) ((windowWidth - frameWidth) / 2d), (int) ((windowHeight - frameHeight) / 2d)); int deviderSize = (int) (frameWidth * (1d / 100d)); int deviderLocationForSpliter0 = (int) (frameWidth / 5d); splitPane0.setDividerLocation(deviderLocationForSpliter0); int deviderLocationForSpliter1 = (int) (frameWidth * (6d / 7d)); splitPane1.setDividerLocation(deviderLocationForSpliter1); int subDeviderLocation = (int) (frameHeight / 6d); splitPane2.setDividerLocation(subDeviderLocation); queryHistoryContainerPanel.setMinimumSize(new Dimension(deviderLocationForSpliter0, 0)); queryRootConatinerPanel.setMinimumSize(new Dimension(0, subDeviderLocation)); queryingTextArea.requestFocus(); resultTable.setModel(new DefaultTableModel() { @Override public boolean isCellEditable(int row, int column) { return false; } }); defaultTableModel = (DefaultTableModel) resultTable.getModel(); resultTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); tableColumnAdjuster = new TableColumnAdjuster(resultTable); historyContainingPanel.setLayout(new GridLayout(0, 1)); }
From source file:Main.java
/** * Computes the maximum bounds of the current screen device. If this method is * called on JDK 1.4, Xinerama-aware results are returned. (See Sun-Bug-ID * 4463949 for details).//w w w .java 2 s . c o m * * @return the maximum bounds of the current screen. */ public static Rectangle getMaximumWindowBounds() { final GraphicsEnvironment localGraphicsEnvironment = GraphicsEnvironment .getLocalGraphicsEnvironment(); try { final Method method = GraphicsEnvironment.class.getMethod("getMaximumWindowBounds", (Class[]) null); return (Rectangle) method.invoke(localGraphicsEnvironment, (Object[]) null); } catch (Exception e) { // ignore ... will fail if this is not a JDK 1.4 .. } final Dimension s = Toolkit.getDefaultToolkit().getScreenSize(); return new Rectangle(0, 0, s.width, s.height); }
From source file:MainClass.java
public Image getImage(URL url) { Toolkit tk = Toolkit.getDefaultToolkit(); return tk.getImage(url); }
From source file:FormattedTextFieldExample.java
protected Document createDefaultModel() { BoundedPlainDocument doc = new BoundedPlainDocument(); doc.addInsertErrorListener(new BoundedPlainDocument.InsertErrorListener() { public void insertFailed(BoundedPlainDocument doc, int offset, String str, AttributeSet a) { // Beep when the field is full Toolkit.getDefaultToolkit().beep(); }// w ww. java 2s. co m }); return doc; }