Esempio n. 1
0
  /** GUIコンポーネントを初期化する。 */
  public void initComponent() {

    frame = new JFrame(ClientContext.getFrameTitle(title));
    frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    frame.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            stop();
          }
        });

    JPanel contentPane = createBrowsePane();
    contentPane.setBorder(BorderFactory.createEmptyBorder(12, 12, 11, 11));

    contentPane.setOpaque(true);
    frame.setContentPane(contentPane);
    frame.pack();

    Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
    int n = ClientContext.isMac() ? 3 : 2;
    int x = (screen.width - frame.getPreferredSize().width) / 2;
    int y = (screen.height - frame.getPreferredSize().height) / n;
    frame.setLocation(x, y);

    blockGlass = new BlockGlass();
    frame.setGlassPane(blockGlass);

    frame.setVisible(true);
  }
Esempio n. 2
0
  public void run() {
    final JFrame mainFrame = new JFrame("MapPanel with place marks");
    final MapPanel mapPanel = new MapPanel(new Point(3636598, 1535138), 14);
    mainFrame.add(mapPanel);

    final DemoGlassPane glassPane = new DemoGlassPane(mapPanel);
    glassPane.addPointToMark(new Point.Double(37.30957, -1.29628));
    glassPane.addPointToMark(new Point.Double(37.70957, -1.49628));
    glassPane.addPointToMark(new Point.Double(36.30957, -2.29628));
    glassPane.addPointToMark(new Point.Double(38.30957, -1.59628));
    mainFrame.setGlassPane(glassPane);

    mainFrame.getGlassPane().setVisible(true);

    mainFrame.pack();
    mainFrame.setVisible(true);
  }