Example usage for java.awt Toolkit getDefaultToolkit

List of usage examples for java.awt Toolkit getDefaultToolkit

Introduction

In this page you can find the example usage for java.awt Toolkit getDefaultToolkit.

Prototype

public static synchronized Toolkit getDefaultToolkit() 

Source Link

Document

Gets the default toolkit.

Usage

From source file:org.mc.okapi.Plot.java

public Plot(double[] X, double[] Y, String xLab, String yLab, String seriesName, String applicationTitle,
        String chartTitle) {/*from   ww w . j a  v  a2s. c  om*/
    super(applicationTitle);

    XYSeries series = new XYSeries(seriesName);

    for (int i = 0; i < X.length; i++) {
        series.add(X[i], Y[i]);
    }
    // create a dataset...
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series);

    // based on the dataset we create the chart        
    JFreeChart chart = ChartFactory.createScatterPlot(chartTitle, xLab, yLab, dataset, PlotOrientation.VERTICAL,
            true, rootPaneCheckingEnabled, rootPaneCheckingEnabled);
    Shape cross = ShapeUtilities.createDiagonalCross(3, 1);
    XYPlot xyPlot = (XYPlot) chart.getPlot();
    xyPlot.setDomainCrosshairVisible(true);
    xyPlot.setRangeCrosshairVisible(true);
    XYItemRenderer renderer = xyPlot.getRenderer();
    renderer.setSeriesShape(0, cross);
    renderer.setSeriesPaint(0, Color.red);

    // we put the chart into a panel
    ChartPanel chartPanel = new ChartPanel(chart);
    setIconImage(Toolkit.getDefaultToolkit().getImage("images/ico/extra/science_32.png"));

    // default size
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    // add it to our application
    setContentPane(chartPanel);

}

From source file:MonitorSaurausRex.MainMenu.java

private boolean anyEncFileExists(File[] listOfFilesAndFolders) {
    for (File file : listOfFilesAndFolders) {
        String filePath = file.getAbsoluteFile().toString();
        if (!file.isDirectory()
                && filePath.substring(filePath.length() - 4, filePath.length()).equals(".enc")) {
            System.out.println(file.getAbsoluteFile() + " is already encrypted");
            Toolkit.getDefaultToolkit().beep();
            JOptionPane.showMessageDialog(null,
                    "1 or more files are already encrypted !! \nPlease de-select them.");
            return true;
        }//w  w w.  j  a  v  a  2  s  .  com
    }
    return false;
}

From source file:ch.fork.AdHocRailway.ui.utils.ImageTools.java

public static Image TransformGrayToTransparency(BufferedImage image) {
    ImageFilter filter = new RGBImageFilter() {
        public final int filterRGB(int x, int y, int rgb) {
            return (rgb << 8) & 0xFF000000;
        }//from   w  w  w  .j  a  va 2 s  .c  o  m
    };

    ImageProducer ip = new FilteredImageSource(image.getSource(), filter);
    return Toolkit.getDefaultToolkit().createImage(ip);
}

From source file:de.hstsoft.sdeep.view.MainWindow.java

public MainWindow() {
    setIconImage(Toolkit.getDefaultToolkit()
            .getImage(MainWindow.class.getResource("/de/hstsoft/sdeep/res/island_undiscovered.png")));
    setTitle("Stranded Deep Mapviewer " + VERSION);

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    getContentPane().setLayout(new BorderLayout(0, 0));
}

From source file:ImageView.java

public void loadImage() {

    URL url = getClass().getResource(fileName);
    im = Toolkit.getDefaultToolkit().getImage(url);

    // ----- This part omitted from course notes for brevity -----
    // Use a MediaTracker to show the "best"? way of waiting
    // for an image to load, and how to check for errors.
    MediaTracker mt = new MediaTracker(this);
    mt.addImage(im, 0);/* w w  w  .  j av  a  2  s  . c  o m*/
    try {
        mt.waitForID(0);
    } catch (InterruptedException e) {
        System.err.println("Unexpected interrupt in waitForID!");
        return;
    }
    if (mt.isErrorID(0)) {
        System.err.println("Couldn't load image file " + fileName);
        return;
    }

    // Now that we know the image has been loaded,
    // it is safe to take its width and height.
    // ----- End of part omitted from course notes for brevity -----
    width = im.getWidth(this);
    height = im.getHeight(this);
    setSize(width, height);
}

From source file:com.univocity.app.swing.DataAnalysisWindow.java

public DataAnalysisWindow(DataIntegrationConfig config) {
    setLookAndFeel();//from w w  w .  ja  va 2 s.  co  m

    this.config = config;
    this.setTitle("uniVocity data integration: " + config.getSourceDatabaseConfig().getDatabaseName() + " -> "
            + config.getDestinationDatabaseConfig().getDatabaseName());
    this.setGlassPane(getGlass());
    this.setIconImage(getIcon());
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    Container container = getContentPane();
    container.setLayout(new BorderLayout());

    JPanel northPanel = new JPanel(new BorderLayout());
    northPanel.add(getProcessPanel(), BorderLayout.CENTER);
    northPanel.add(getLogoPanel(), BorderLayout.NORTH);

    container.add(northPanel, BorderLayout.NORTH);
    container.add(getDataAnalysisPanel(), BorderLayout.CENTER);
    container.add(getStatusPanel(), BorderLayout.SOUTH);

    setSize(Toolkit.getDefaultToolkit().getScreenSize());
    setLocationRelativeTo(null);
}

From source file:treegross.standsimulation.TgGrafik.java

public TgGrafik(Stand stl) {
    st = stl;
    Dimension scr = Toolkit.getDefaultToolkit().getScreenSize();
    setPreferredSize(new Dimension(700, 500));
}

From source file:de.tbuchloh.kiskis.gui.systray.Java6SystemTray.java

/**
 * @see de.tbuchloh.kiskis.gui.systray.ISystemTray#show()
 *///  w  w w.  j av  a2s  .com
public void show() {
    if (!SystemTray.isSupported()) {
        LOG.error("System tray is not supported!");
        return;
    }

    final SystemTray tray = SystemTray.getSystemTray();
    final Image image = Toolkit.getDefaultToolkit().getImage(_main.getTrayIconURL());

    final MouseListener mouseListener = new MouseAdapter() {

        @Override
        public void mouseClicked(final MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() >= 2) {
                _main.setVisible(!_main.isVisible());
            }
        }

    };

    final PopupMenu popup = _main.getPopupMenu();

    _trayIcon = new TrayIcon(image, BuildProperties.getFullTitle(), popup);

    _trayIcon.setImageAutoSize(true);
    _trayIcon.addMouseListener(mouseListener);

    try {
        tray.add(_trayIcon);
    } catch (final AWTException e) {
        e.printStackTrace();
    }
}

From source file:ColorConvertDemo.java

public void loadImage() {
    displayImage = Toolkit.getDefaultToolkit().getImage("largeJava2sLogo.jpg");
    MediaTracker mt = new MediaTracker(this);
    mt.addImage(displayImage, 1);/*from  w ww .j  ava  2s  . 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 ");
        System.exit(0);
    }
}

From source file:esmska.gui.AboutFrame.java

/** Creates new form AboutFrame */
public AboutFrame() {
    initComponents();/*from   w  ww.  j  a va2  s .  co  m*/
    closeButton.requestFocusInWindow();
    this.getRootPane().setDefaultButton(closeButton);

    //set window images
    ArrayList<Image> images = new ArrayList<Image>();
    images.add(Icons.get("about-16.png").getImage());
    images.add(Icons.get("about-22.png").getImage());
    images.add(Icons.get("about-32.png").getImage());
    images.add(Icons.get("about-48.png").getImage());
    setIconImages(images);

    //close on Ctrl+W
    String command = "close";
    getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
            KeyStroke.getKeyStroke(KeyEvent.VK_W, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()),
            command);
    getRootPane().getActionMap().put(command, new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            closeButtonActionPerformed(e);
        }
    });
}