List of usage examples for java.awt Toolkit getDefaultToolkit
public static synchronized Toolkit getDefaultToolkit()
From source file:Splash.java
/** Maximize a window, the hard way. */ public static void maximize(Window w) { Dimension us = w.getSize(), them = Toolkit.getDefaultToolkit().getScreenSize(); w.setBounds(0, 0, them.width, them.height); }
From source file:TextTransferTest.java
/** * Pastes the text from the system clipboard into the text area. *///from w ww.j a v a2 s . com private void paste() { Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); DataFlavor flavor = DataFlavor.stringFlavor; if (clipboard.isDataFlavorAvailable(flavor)) { try { String text = (String) clipboard.getData(flavor); textArea.replaceSelection(text); } catch (UnsupportedFlavorException e) { JOptionPane.showMessageDialog(this, e); } catch (IOException e) { JOptionPane.showMessageDialog(this, e); } } }
From source file:NewGUI.Statistics.java
public Statistics() { filter = new Filter(this, user); Database.setState();//from w w w . j a va2 s. c o m initComponents(); jpChart.setLayout(new BorderLayout()); jpChart.add(chartPanel); initStatistics(); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); int w = this.getWidth(); int h = this.getHeight(); int x = (dim.width - w) / 2; int y = (dim.height - h) / 2; this.setLocation(x, y); }
From source file:ConvolveApp.java
public void loadImage() { displayImage = Toolkit.getDefaultToolkit().getImage("largeJava2sLogo.jpg"); MediaTracker mt = new MediaTracker(this); mt.addImage(displayImage, 1);/*from ww w.j a va 2 s . c o m*/ try { mt.waitForAll(); } catch (Exception e) { System.out.println("Exception while loading."); } if (displayImage.getWidth(this) == -1) { System.out.println("No jpg file"); System.exit(0); } }
From source file:piilSource.Histogram.java
public Histogram(final String s, List<List<String>> list, Character meta) { super(s);/*from w w w . j av a 2s . c o m*/ metaLabel = (meta.equals('M')) ? "beta" : "expression"; histogramPanel = createDemoPanel(s, list, metaLabel); histogramPanel.setPreferredSize(new Dimension(500, 270)); setContentPane(histogramPanel); exportButton = new JButton("Export to image"); exportButton.setPreferredSize(new Dimension(150, 30)); closeButton = new JButton("Close"); closeButton.setPreferredSize(new Dimension(150, 30)); buttonsPanel = new JPanel(); buttonsPanel.setLayout(new FlowLayout()); buttonsPanel.setBackground(Color.WHITE); buttonsPanel.add(exportButton); buttonsPanel.add(closeButton); exportButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent bc) { ExportDialog export = new ExportDialog(); export.showExportDialog(chartFrame, "Export view as ...", histogramPanel, "Histogram of the " + metaLabel + " values for all samples - " + s); } }); closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { chartFrame.dispose(); } }); chartFrame = new JFrame(); chartFrame.setLayout(new BorderLayout()); chartFrame.setSize(400, 100); Toolkit tk = Toolkit.getDefaultToolkit(); Dimension dim = tk.getScreenSize(); int xPos = (dim.width / 2) - (chartFrame.getWidth() / 2); int yPos = (dim.height / 2) - (chartFrame.getHeight() / 2); chartFrame.setLocation(xPos, yPos); chartFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); chartFrame.add(histogramPanel, BorderLayout.CENTER); chartFrame.add(buttonsPanel, BorderLayout.SOUTH); chartFrame.setSize(800, 400); chartFrame.setVisible(true); }
From source file:QandE.Beeper2.java
private void startBeeping(int numBeeps) { Toolkit.getDefaultToolkit().beep(); if (numBeeps > 1) { if (timer == null) { timer = new Timer(500, this); }/*from w w w . ja v a 2 s. c o m*/ beepsRemaining = numBeeps - 1; timer.start(); } }
From source file:SimpleBufferedImageDemo.java
DisplayCanvas() { displayImage = Toolkit.getDefaultToolkit().getImage("largeJava2sLogo.jpg"); MediaTracker mt = new MediaTracker(this); mt.addImage(displayImage, 1);/*from ww w . j a v a 2 s .c o m*/ try { mt.waitForAll(); } catch (Exception e) { System.out.println("Exception while loading."); } if (displayImage.getWidth(this) == -1) { System.out.println("No *.jpg file"); System.exit(0); } setBackground(Color.white); setSize(400, 225); }
From source file:co.com.soinsoftware.hotelero.view.JFRoomPayment.java
public JFRoomPayment(final JFRoom jfRoom) { this.jfRoom = jfRoom; this.invoiceController = new InvoiceController(); invoiceStatusController = new InvoiceStatusController(); invoiceItemController = new InvoiceItemController(); roomStatusController = new RoomStatusController(); this.roomStatusEnabled = roomStatusController.selectEnabled(); this.statusBillToCompany = invoiceStatusController.selectBillToCompany(); this.initComponents(); final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); this.setLocation((int) (screenSize.getWidth() / 2 - 350), (int) (screenSize.getHeight() / 2 - 350)); this.setModal(true); this.setInvoiceStatusModel(); this.jcbAccountState.setEnabled(false); }
From source file:co.com.soinsoftware.hotelero.view.JFRoomService.java
public JFRoomService() { this.invoiceController = new InvoiceController(); this.serviceController = new ServiceController(); invoiceItemController = new InvoiceItemController(); serviceTypeController = new ServiceTypeController(); this.initComponents(); final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); this.setLocation((int) (screenSize.getWidth() / 2 - 350), (int) (screenSize.getHeight() / 2 - 350)); this.setModal(true); }
From source file:corelyzer.util.StringUtility.java
public static void setClipboard(final String aString) { StringSelection stringSelection = new StringSelection(aString); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(stringSelection, new ClipboardOwner() { public void lostOwnership(final Clipboard clipboard, final Transferable transferable) { // do nothing }/*from w ww .j a v a 2 s .c o m*/ }); }