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:it.alus.GPSreceiver.instruments.Altimeter.java

public Altimeter(float groundAltitudeFt) {
    super(null);//from   w w  w .  j  ava2 s.  co m
    altitude = 0;
    if (groundAltitudeFt < 0)
        groundAltitude = 0;
    else
        groundAltitude = groundAltitudeFt;
    hoursDataset = new DefaultValueDataset(0.0);
    minutesDataset = new DefaultValueDataset(0.0);
    DialPlot plot = new DialPlot();
    plot.setView(0.0, 0.0, 1.0, 1.0);
    Image background = Toolkit.getDefaultToolkit().getImage(getClass().getResource("altimeter.png"));
    plot.setDataset(0, hoursDataset);
    plot.setDataset(1, minutesDataset);
    StandardDialFrame dialFrame = new StandardDialFrame();
    dialFrame.setBackgroundPaint(Color.lightGray);
    dialFrame.setForegroundPaint(Color.gray);
    DialTextAnnotation annotation = new DialTextAnnotation("Feet");
    annotation.setFont(new Font("Arial", 1, 14));
    annotation.setRadius(0.4D);
    annotation.setPaint(Color.lightGray);
    plot.addLayer(annotation);
    DialValueIndicator valueindicator = new DialValueIndicator(0);
    NumberFormat formatter = new DecimalFormat("#");
    plot.addLayer(valueindicator);
    plot.setDialFrame(dialFrame);
    StandardDialScale scale = new StandardDialScale(0, 10, 90, -360, 1, 10);
    scale.setMajorTickPaint(Color.white);
    scale.setMinorTickPaint(Color.lightGray);
    scale.setFirstTickLabelVisible(false);
    scale.setTickRadius(0.88);
    scale.setTickLabelOffset(0.15);
    scale.setTickLabelFormatter(formatter);
    scale.setTickLabelFont(new Font("Arial", Font.BOLD, 24));
    scale.setTickLabelPaint(Color.white);
    plot.addScale(3, scale);
    plot.setBackground(new DialBackground(Color.black));
    StandardDialScale hourScale = new StandardDialScale(0, 10000, 90, -360, 1000, 10);
    hourScale.setVisible(false);
    hourScale.setTickRadius(0.88);
    hourScale.setTickLabelOffset(0.15);
    plot.addScale(0, hourScale);
    StandardDialScale minScale = new StandardDialScale(0, 1000, 90, -360, 0, 0);
    minScale.setVisible(false);
    minScale.setMajorTickIncrement(5.0);
    minScale.setTickRadius(0.68);
    plot.addScale(1, minScale);
    Pointer hourNeedle = new Pointer(0);
    hourNeedle.setRadius(0.55);
    hourNeedle.setFillPaint(Color.lightGray);
    plot.addLayer(hourNeedle);
    plot.mapDatasetToScale(1, 1);
    Pointer minNeedle = new Pointer(1);
    minNeedle.setFillPaint(Color.white);
    plot.addLayer(minNeedle);
    DialCap cap = new DialCap();
    cap.setRadius(0.10);
    cap.setFillPaint(Color.lightGray);
    plot.setCap(cap);
    jChart = new JFreeChart(plot);
    jChart.setBackgroundImage(background);
    super.setChart(jChart);
    super.setPreferredSize(new Dimension(400, 400));
}

From source file:Framework.java

public Framework() {
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    maxX = screenSize.width - 50;
    maxY = screenSize.height - 50;
    makeNewWindow();
}

From source file:cz.babi.desktop.remoteme.common.Controller.java

/**
 * Init clipboard.//  w ww  .  j av  a2 s  . co  m
 */
public void initClipboard() {
    clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();

    clipboardOwner = new ClipboardOwner() {
        @Override
        public void lostOwnership(Clipboard clipboard, Transferable contents) {
            if (Common.DEBUG)
                LOGGER.debug("[lostOwnership]");
        }
    };
}

From source file:com.akman.excel.view.frmExportExcel.java

public frmExportExcel() {
    setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icon/Wood.png")));
    initComponents();

}

From source file:net.sf.keystore_explorer.gui.actions.ExportKeyPairCertificateChainAction.java

/**
 * Construct action.//from ww w. j a v  a2 s  . co  m
 *
 * @param kseFrame
 *            KeyStore Explorer frame
 */
public ExportKeyPairCertificateChainAction(KseFrame kseFrame) {
    super(kseFrame);

    putValue(LONG_DESCRIPTION, res.getString("ExportKeyPairCertificateChainAction.statusbar"));
    putValue(NAME, res.getString("ExportKeyPairCertificateChainAction.text"));
    putValue(SHORT_DESCRIPTION, res.getString("ExportKeyPairCertificateChainAction.tooltip"));
    putValue(SMALL_ICON, new ImageIcon(Toolkit.getDefaultToolkit()
            .createImage(getClass().getResource(res.getString("ExportKeyPairCertificateChainAction.image")))));
}

From source file:org.epsilonlabs.workflow.execution.example.GraphOutput.java

public GraphOutput(String appname, String graphname, String x, String y) {
    super(appname);
    barChart = ChartFactory.createBarChart(graphname, x, y, dataset, PlotOrientation.VERTICAL, false, true,
            false);//w ww .ja v a 2  s.  co m

    ChartPanel chartPanel = new ChartPanel(barChart);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    int width = new Double(screenSize.getWidth()).intValue() - 100;
    chartPanel.setMaximumDrawHeight(500);
    chartPanel.setMaximumDrawWidth(width);
    chartPanel.setPreferredSize(new java.awt.Dimension(width, 500));
    setContentPane(chartPanel);

    Font font = new Font("Dialog", Font.PLAIN, 15);
    barChart.getCategoryPlot().getDomainAxis().setTickLabelFont(font);
    barChart.getCategoryPlot().setColumnRenderingOrder(SortOrder.DESCENDING);

}

From source file:net.sf.keystore_explorer.gui.actions.ExportKeyPairPublicKeyAction.java

/**
 * Construct action.//from  www. j  a  v  a  2  s .  c  om
 *
 * @param kseFrame
 *            KeyStore Explorer frame
 */
public ExportKeyPairPublicKeyAction(KseFrame kseFrame) {
    super(kseFrame);

    putValue(LONG_DESCRIPTION, res.getString("ExportKeyPairPublicKeyAction.statusbar"));
    putValue(NAME, res.getString("ExportKeyPairPublicKeyAction.text"));
    putValue(SHORT_DESCRIPTION, res.getString("ExportKeyPairPublicKeyAction.tooltip"));
    putValue(SMALL_ICON, new ImageIcon(Toolkit.getDefaultToolkit()
            .createImage(getClass().getResource(res.getString("ExportKeyPairPublicKeyAction.image")))));
}

From source file:com.antelink.sourcesquare.gui.view.ExitSourceSquareView.java

/**
 * Create the frame./*www .  j a v a2 s. c  o  m*/
 */
public ExitSourceSquareView() {
    setIconImage(Toolkit.getDefaultToolkit().getImage(SourceSquareView.class.getResource("/antelink.png")));
    setTitle("SourceSquare");
    setResizable(false);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 500, 170);
    this.contentPane = new JPanel();
    this.contentPane.setBackground(Color.WHITE);
    this.contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(this.contentPane);

    this.mainPanel = new JPanel();
    this.mainPanel.setBackground(Color.WHITE);
    GroupLayout gl_contentPane = new GroupLayout(this.contentPane);
    gl_contentPane.setHorizontalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
            .addComponent(this.mainPanel, GroupLayout.DEFAULT_SIZE, 428, Short.MAX_VALUE));
    gl_contentPane.setVerticalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
            .addComponent(this.mainPanel, GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE));
    this.mainPanel.setLayout(new BoxLayout(this.mainPanel, BoxLayout.Y_AXIS));

    JPanel panel_1 = new JPanel();
    panel_1.setBackground(Color.WHITE);
    this.mainPanel.add(panel_1);
    panel_1.setLayout(new BorderLayout(0, 0));

    JPanel panel = new JPanel();
    panel.setLayout(new FlowLayout(FlowLayout.CENTER, 50, 20));
    panel.setBackground(Color.WHITE);
    panel_1.add(panel, BorderLayout.SOUTH);

    Image openButtonImage = Toolkit.getDefaultToolkit()
            .getImage(SourceSquareView.class.getResource("/OpenButton.png"));
    this.openButtonLabel = new JLabel(new ImageIcon(openButtonImage));
    this.openButtonLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    panel.add(this.openButtonLabel);

    JLabel exitLabel = new JLabel("<html><b>Closing this window will quit the application</b></html>");
    exitLabel.setFont(new Font("Helvetica", Font.PLAIN, 13));

    JLabel explainLabel = new JLabel("<html>(You won't be able to see or publish your results anymore)</html>");
    explainLabel.setFont(new Font("Helvetica", Font.PLAIN, 13));

    JPanel textPanel = new JPanel();
    textPanel.setBackground(Color.WHITE);
    textPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 0));

    textPanel.add(exitLabel, BorderLayout.CENTER);
    textPanel.add(explainLabel, BorderLayout.CENTER);

    panel_1.add(textPanel, BorderLayout.CENTER);

    CopyrightPanel copyrightPanel = new CopyrightPanel();
    copyrightPanel.setBackground(Color.WHITE);
    this.mainPanel.add(copyrightPanel);
    this.contentPane.setLayout(gl_contentPane);

    setLocationRelativeTo(null);
}

From source file:ec.ui.chart.ChartPopup.java

/**
 * Sets the location of the popup./*  ww w.  j a v a2s.  c om*/
 * If the given location places the popup outside of the screen, the location
 * is adapted to be placed at the maximum visible location.
 * @param p Point on the screen where the upper left corner of the popup
 * must be placed.
 */
@Override
public void setLocation(Point p) {
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    int x = p.x;
    int y = p.y;

    if (x + getWidth() > screenSize.width) {
        x = screenSize.width - getWidth();
    }

    if (y + getHeight() > screenSize.height) {
        y = screenSize.height - getHeight();
    }

    super.setLocation(x, y);
}

From source file:jpad.MainEditor.java

public MainEditor(boolean isOSX) {
    initComponents();/* w w w. j  a va 2  s  . com*/
    _isOSX = isOSX;
    macSpecifics();
    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    this.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2);
}