@SuppressWarnings("unused")
 private boolean isLegal() {
   try {
     int row = Integer.parseInt(rowField.getText());
     if (row <= 0) {
       HintFrame hint =
           new HintFrame(
               "排数必须为正!", frame.getX(), frame.getY(), frame.getWidth(), frame.getHeight());
       return false;
     }
   } catch (NumberFormatException e) {
     HintFrame hint =
         new HintFrame("排数格式错误!", frame.getX(), frame.getY(), frame.getWidth(), frame.getHeight());
     return false;
   }
   try {
     int place = Integer.parseInt(placeField.getText());
     if (place <= 0) {
       HintFrame hint =
           new HintFrame(
               "每排位数必须为正!", frame.getX(), frame.getY(), frame.getWidth(), frame.getHeight());
       return false;
     }
   } catch (NumberFormatException e) {
     HintFrame hint =
         new HintFrame(
             "每排位数格式错误!", frame.getX(), frame.getY(), frame.getWidth(), frame.getHeight());
     return false;
   }
   return true;
 }
Beispiel #2
0
  @Override
  protected void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D graphics = (Graphics2D) g;

    graphics.setPaint(Color.GREEN);

    Ellipse2D.Double circle =
        new Ellipse2D.Double(ball.getX(), ball.getY(), ball.getDiameter(), ball.getDiameter());

    // graphics.fillOval(ball.getX(), ball.getY(), ball.getDiameter(), ball.getDiameter());
    graphics.fill(circle);
    if (frame.getWidth() != frameWidth || frame.getHeight() != frameHeight) {
      repaint();
      updateSizes(frame.getWidth(), frame.getHeight());
    }

    try {
      Thread.sleep(7);
    } catch (InterruptedException e) {
    }
    if (begin && !grabBall) {
      moveBall();
    } else if (grabBall) {
      followMouse();
    }
  }
Beispiel #3
0
  /**
   * Moves the paddle right by the movement offset field within the picture window's bounds
   *
   * @param pict is the Picture object with the boundary to keep the paddle within
   */
  public void moveRight(JFrame pict) {
    this.x += this.offset; // Move x right by the offset

    // Test to see if the boundary was in the way on the right
    if (this.x + this.width > pict.getWidth())
      this.x = pict.getWidth() - this.width; // If so, set right to right edge
  }
Beispiel #4
0
  /**
   * Moves the paddle right by the movement offset field within the picture window's bounds avoiding
   * the given ball
   *
   * @param pict is the Picture object with the boundary to keep the paddle within
   * @param ball is a ball that causes the paddle to move back if it's in the way
   */
  public void moveRight(JFrame pict, Ball ball) {
    this.x += this.offset; // Move x right by the offset

    // Test to see if the paddle moved into the ball
    if (ball.distance(this.x + this.width, this.y) < ball.getRadius()
        || ball.distance(this.x + this.width, this.y + this.height / 2) < ball.getRadius()
        || ball.distance(this.x + this.width, this.y + this.height) < ball.getRadius())
      this.x -= this.offset; // If so, move it out of the ball

    // Test to see if the boundary was in the way on the right
    if (this.x + this.width > pict.getWidth())
      this.x = pict.getWidth() - this.width; // If so, set right to right edge
  }
  synchronized void resetScalingFactors() {
    double width = frame.getWidth();
    double height = frame.getHeight();

    scaleFactorWidth = width / res_width;
    scaleFactorHeight = height / res_height;
  }
 private void centraLaVentana() throws HeadlessException {
   Toolkit toolkit = ventanaPrincipal.getToolkit();
   Dimension size = toolkit.getScreenSize();
   ventanaPrincipal.setLocation(
       (size.width - ventanaPrincipal.getWidth()) / 2,
       (size.height - ventanaPrincipal.getHeight()) / 2);
 }
Beispiel #7
0
  @Override
  public void streamOpen() {
    if (isStreamOpen) {
      L.og("INTERNAL L ERROR: trying to re-open alreadyopen stream ");
      return;
    }

    logFrame = new JFrame("Logging Window");
    logArea = new JTextArea();
    logArea.setEditable(false);

    logFrame.setSize(width, height);
    logFrame.setResizable(false);
    logFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

    JScrollPane logAreaScroller = new JScrollPane(logArea);
    logAreaScroller.setSize(logFrame.getSize());
    logAreaScroller.setPreferredSize(
        new Dimension((logFrame.getWidth() * 3) / 4, (logFrame.getHeight() * 3) / 4));

    logPanel.add(logAreaScroller);
    logFrame.getContentPane().add(logPanel);

    logFrame.setVisible(true);

    isStreamOpen = true;
  }
Beispiel #8
0
 private void setLocation() {
   if (this.isVisible() && ((Editor) component).centerPanel.isVisible()) {
     int xLocation = component.getX() + component.getWidth();
     int yLocation = ((Editor) component).centerPanel.getLocationOnScreen().y;
     this.setLocation(xLocation, yLocation);
   }
 }
  @Override
  public void run() {
    Thread videoDecoder = new Thread(new VideoDecoder(this));
    videoDecoder.start();
    long lastFrameWrite = System.nanoTime() - NANOSECONDS_PER_FRAME;
    long timeNow = 0;

    try {
      while ((!videoDecoded || !imgBuffer.isEmpty()) && frame.isVisible()) {
        timeNow = System.nanoTime();
        if (timeNow - lastFrameWrite >= NANOSECONDS_PER_FRAME) {
          lastFrameWrite = timeNow;
          BufferedImage img = imgBuffer.take();
          g.drawImage(img, 0, 0, frame.getWidth(), frame.getHeight(), null);

          ByteArrayOutputStream bos = new ByteArrayOutputStream();
          ImageIO.write(img, "jpg", bos);
          proxy.receiveImage(ByteBuffer.wrap(bos.toByteArray()));
        }
      }
    } catch (IOException | InterruptedException e) {
      // other user has disconnected, stop sending video
    }

    imgBuffer.clear();
    frame.setVisible(false);
    try {
      proxy.setFrameVisible(true, false);
    } catch (IOException e) {
      System.err.println("The other user has disconnected, stopping video.");
    }
  }
Beispiel #10
0
  // 设置窗体居中
  public static void setFrameCenter(JFrame jf) {
    /*
    思路:
    A:获取屏幕的宽和高
    B:获取窗体的宽和高
    C:(用屏幕的宽-窗体的宽)/2,(用屏幕的高-窗体的高)/2作为窗体的新坐标。
    */
    // 获取工具对象
    Toolkit tk = Toolkit.getDefaultToolkit();

    // 获取屏幕的宽和高
    Dimension d = tk.getScreenSize();
    double srceenWidth = d.getWidth();
    double srceenHeigth = d.getHeight();

    // 获取窗体的宽和高
    int frameWidth = jf.getWidth();
    int frameHeight = jf.getHeight();

    // 获取新的宽和高
    int width = (int) (srceenWidth - frameWidth) / 2;
    int height = (int) (srceenHeigth - frameHeight) / 2;

    // 设置窗体坐标
    jf.setLocation(width, height);
  }
Beispiel #11
0
  public PassWord() {

    flogin = new JFrame();
    panel = new JPanel();
    panel.setPreferredSize(new Dimension(400, 300));
    panel.setOpaque(false); // 设置透明
    flogin.setResizable(false);
    randomphoto = new random();
    ImageIcon titleIcon = new ImageIcon(getClass().getResource("/image/1.jpg")); // 获取图片
    randomno = new JLabel(new ImageIcon(randomphoto.creatImage()));
    ImagePanel jDialogImage = new ImagePanel("/image/2.jpg");

    flogin.setContentPane(jDialogImage); // 设置背景图片
    jDialogImage.setBounds(0, 0, flogin.getWidth(), flogin.getHeight());
    flogin.setIconImage(titleIcon.getImage()); // 设置图标

    initframe();

    contentPane = flogin.getContentPane();
    layout1 = new SpringLayout();
    layout2 = new SpringLayout();
    add();
    contentPane.setLayout(layout1);
    signIn.addActionListener(this);
    reset.addActionListener(this);
    flogin.setBounds(400, 120, 400, 300);
    flogin.getRootPane().setDefaultButton(signIn); // 设置响应回车键
    flogin.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    flogin.setVisible(true);
    contentPane.add(panel);
  }
Beispiel #12
0
  public static void pop(String message) {
    JFrame f = new JFrame();
    f.add(new JLabel(message));
    f.setAlwaysOnTop(true);
    f.pack();
    f.setVisible(true);
    final int thisHeight = f.getHeight();
    f.addWindowListener(
        new WindowListener() {
          public void windowOpened(WindowEvent e) {}

          public void windowIconified(WindowEvent e) {}

          public void windowDeiconified(WindowEvent e) {}

          public void windowDeactivated(WindowEvent e) {}

          public void windowClosing(WindowEvent e) {
            currentHeight = currentHeight - thisHeight;
          }

          public void windowClosed(WindowEvent e) {}

          public void windowActivated(WindowEvent e) {}
        });
    f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    currentHeight = currentHeight + thisHeight;
    f.setLocation(screenWidth - f.getWidth(), screenHeight - currentHeight);
  }
  /** Displays the character window */
  public void characterWindow() {
    if (characterWindow != null) {
      characterWindow.dispose();
    }
    characterWindow = new JFrame("Character");
    characterWindow.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    JTextField health = new JTextField(player.health());
    health.setEditable(false);

    JButton weapon = new JButton(player.weapon().split(" ")[1]);
    if (player.weapon().split(" ")[1].equals("none")) {
      weapon.setEnabled(false);
    }
    weapon.addActionListener(this);

    JButton armor = new JButton(player.armor().split(" ")[1]);
    if (player.armor().split(" ")[1].equals("none")) {
      armor.setEnabled(false);
    }
    armor.addActionListener(this);

    characterWindow.setBounds(
        mainWindow.getX() + mainWindow.getWidth(), mainWindow.getY(), 200, 150);
    characterWindow.setResizable(false);
    characterWindow.setLayout(new GridLayout(3, 1));
    characterWindow.add(health);
    characterWindow.add(weapon);
    characterWindow.add(armor);

    characterWindow.setVisible(true);
  }
Beispiel #14
0
  public static void main(String[] argv) throws AWTException {
    final JFrame f = new JFrame("Robot Test");
    final JButton b = new JButton("Click me");
    final JTextField tf = new JTextField();
    final RobotTest t = new RobotTest();
    f.add(tf, BorderLayout.NORTH);
    f.add(t, BorderLayout.CENTER);
    f.add(b, BorderLayout.SOUTH);
    f.pack();
    f.setLocation(0, 0);
    f.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            f.dispose();
          }
        });
    f.setVisible(true);

    final Robot r = new Robot();
    r.setAutoDelay(50);
    r.delay(1000);
    image = r.createScreenCapture(new Rectangle(0, 0, 200, 200));
    t.repaint();
    //        for(int i = 0; i < 400; i++){
    //            r.mouseMove(i, i);
    //        }

    b.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            tf.setText("Clicked !");
          }
        });

    moveToCenterOfComponent(r, b);
    r.mousePress(InputEvent.BUTTON1_MASK);
    r.mouseRelease(InputEvent.BUTTON1_MASK);

    Point p = f.getLocationOnScreen();
    p.translate(f.getWidth() / 2, 5);
    r.mouseMove((int) p.getX(), (int) p.getY());
    r.mousePress(InputEvent.BUTTON1_MASK);
    for (int i = 0; i < 100; i++) {
      r.mouseMove((int) p.getX() + i, (int) p.getY() + i);
    }
    r.mouseRelease(InputEvent.BUTTON1_MASK);
    t.addMouseMotionListener(
        new MouseMotionAdapter() {
          public void mouseMoved(MouseEvent event) {
            Point p = event.getPoint();
            SwingUtilities.convertPointToScreen(p, t);
            crtColor = r.getPixelColor(p.x, p.y);
            // Graphics g = t.getGraphics();
            // g.setColor(crtColor);
            // g.fillRect(25,225, 50,50);
            t.repaint();
          }
        });
  }
Beispiel #15
0
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    int width = frame.getWidth();
    int height = frame.getHeight();
    Point p = new Point(startPoistion.getX(), startPoistion.getY());

    glyph.draw(g, p, width, height);
  }
Beispiel #16
0
 public void grab(JFrame grabbedFrame) {
   this.grabbedFrame = grabbedFrame;
   if (grabbedFrame != null && robot != null) {
     x = grabbedFrame.getX() + grabbedFrame.getWidth() / 2;
     y = grabbedFrame.getY() + grabbedFrame.getHeight() / 2;
     robot.mouseMove(x, y);
   }
 }
 private void setMiddle() {
   Point point = owner.getLocationOnScreen();
   int x = point.x;
   int y = point.y;
   int width = (int) ((owner.getWidth() - this.getWidth()) / 2);
   int height = (int) ((owner.getHeight() - this.getHeight()) / 2);
   this.setLocation(x + width, y + height);
 }
Beispiel #18
0
 public static void setFrameCenter(JFrame jf) {
   // ЙМол
   Toolkit toolkit = Toolkit.getDefaultToolkit();
   Dimension screen = toolkit.getScreenSize();
   int x = (screen.width - jf.getWidth()) >> 1;
   int y = (screen.height - jf.getHeight() >> 1) - 32;
   jf.setLocation(x, y);
 }
  public FrameRenderer(final JFrame target, boolean isFullscreen, RenderFitMode renderFitMode) {
    m_renderTarget = target;
    m_renderFitMode = renderFitMode;

    m_renderTarget.setSize(target.getSize());

    m_canvasRenderWidth = target.getWidth();
    m_canvasRenderHeight = target.getHeight();

    target.setIgnoreRepaint(true);
    target.createBufferStrategy(2);
    m_bufferStrategy = target.getBufferStrategy();

    BufferCapabilities cap = m_bufferStrategy.getCapabilities();

    if (!cap.getBackBufferCapabilities().isAccelerated())
      m_logger.warn("Backbuffer is not accelerated, may result in poorer render performance.");

    if (!cap.isPageFlipping())
      m_logger.warn(
          "Page flipping is not supported by this device. This may result in increased image flicker or tearing.");

    if (!cap.isMultiBufferAvailable())
      m_logger.warn(
          "Multiple buffering for page flipping is not supported by this device. This may result in poorer performance.");

    if (cap.isFullScreenRequired() && !isFullscreen)
      m_logger.warn(
          "Full screen required for hardware acceleration - not running in fullscreen may cause performance issues.");

    if (isFullscreen) {
      enterFullscreen();

      target.addKeyListener(
          new KeyListener() {

            @Override
            public void keyTyped(KeyEvent e) {}

            @Override
            public void keyReleased(KeyEvent e) {}

            @Override
            public void keyPressed(KeyEvent e) {
              if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
                GraphicsDevice device = target.getGraphicsConfiguration().getDevice();

                Window fullscreen = device.getFullScreenWindow();

                if (fullscreen != target) fullscreen = null;

                if (fullscreen == null) enterFullscreen();
                else exitFullscreen();
              }
            }
          });
    }
  }
 /** 设置布局居中 */
 public static void setLayoutCenter(JFrame frame) {
   int windowWidth = frame.getWidth(); // 获得窗口宽
   int windowHeight = frame.getHeight(); // 获得窗口高
   Toolkit kit = Toolkit.getDefaultToolkit(); // 定义工具包
   Dimension screenSize = kit.getScreenSize(); // 获取屏幕的尺寸
   int screenWidth = screenSize.width; // 获取屏幕的宽
   int screenHeight = screenSize.height; // 获取屏幕的高
   frame.setLocation(screenWidth / 2 - windowWidth / 2, screenHeight / 2 - windowHeight / 2);
 }
Beispiel #21
0
 /** Sets up and displays the GUI for this application. */
 public void start() {
   myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   setupComponents();
   myFrame.pack();
   myFrame.setVisible(true);
   myFrame.setLocation(
       SCREEN_SIZE.width / 2 - myFrame.getWidth() / 2,
       SCREEN_SIZE.height / 2 - myFrame.getHeight() / 2);
 }
Beispiel #22
0
 /** Creates new form ViewPrompt */
 public ViewPrompt(JFrame f) {
   this.f = f;
   setAlwaysOnTop(true);
   setUndecorated(true);
   initComponents();
   setLocation(
       f.getX() + (f.getWidth() - getWidth()) / 2, f.getY() + (f.getHeight() - getHeight()) / 2);
   setVisible(true);
 }
 // Paints JPanel in the center of the screen
 private void paintPanel() {
   // center the dialog
   panel1.setLocation(
       (screen.getWidth() - panel1.getWidth()) / 2, (screen.getHeight() - panel1.getHeight()) / 2);
   // add the dialog to the "modal dialog" layer of the
   // screen's layered pane.
   Container contentPane = screen.getContentPane();
   contentPane.add(panel1);
 }
Beispiel #24
0
  public StatusBar(JFrame parent) throws Exception {
    if (parent.getWidth() < 500 || parent.getHeight() < 200) {
      throw new Exception("Frame to put status bar in is too small!");
    }
    width = parent.getWidth();
    height = 100;
    padding = 10;
    level = 1;

    hBound = new Rectangle(padding, padding, width / 3 - 2 * padding, height - 2 * padding);
    mBound =
        new Rectangle(
            width * 2 / 3 + padding, padding, width / 3 - 2 * padding, height - 2 * padding);
    hp = new Rectangle(hBound);
    mp = new Rectangle(mBound);
    bound = new Line2D.Double(0, height, width, height);
    isWin = false;
  }
  public AttributeEditorDialog(JFrame owner, Operator exampleSource) {
    super(owner, "attribute_editor", true);

    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    addWindowListener(this);

    DataControl control = new DataControl(0, 0, "Example", "Attribute", false);
    attributeEditor = new AttributeEditor(exampleSource, control);
    control.addViewChangeListener(attributeEditor);
    getContentPane().add(control, BorderLayout.WEST);
    getContentPane().add(new ExtendedJScrollPane(attributeEditor), BorderLayout.CENTER);
    control.update();

    // initialize actions
    initActions();

    // menu bar
    JMenuBar menuBar = new JMenuBar();

    JMenu fileMenu = new ResourceMenu("attribute_editor_file");
    fileMenu.add(OPEN_ATTRIBUTE_FILE_ACTION);
    fileMenu.add(SAVE_ATTRIBUTE_FILE_ACTION);
    fileMenu.add(LOAD_DATA_ACTION);
    fileMenu.add(SAVE_DATA_ACTION);
    fileMenu.add(LOAD_SERIES_DATA_ACTION);
    fileMenu.addSeparator();
    fileMenu.add(CLOSE_ACTION);
    menuBar.add(fileMenu);

    JMenu tableMenu = new ResourceMenu("attribute_editor_table");
    tableMenu.add(attributeEditor.GUESS_TYPE_ACTION);
    tableMenu.add(attributeEditor.GUESS_ALL_TYPES_ACTION);
    tableMenu.add(attributeEditor.REMOVE_COLUMN_ACTION);
    tableMenu.add(attributeEditor.REMOVE_ROW_ACTION);
    tableMenu.add(attributeEditor.USE_ROW_AS_NAMES_ACTION);
    tableMenu.add(CLEAR_ACTION);
    menuBar.add(tableMenu);

    setJMenuBar(menuBar);

    // tool bar
    JToolBar toolBar = new ExtendedJToolBar();
    toolBar.add(OPEN_ATTRIBUTE_FILE_ACTION);
    toolBar.add(SAVE_ATTRIBUTE_FILE_ACTION);
    toolBar.add(LOAD_DATA_ACTION);
    toolBar.add(SAVE_DATA_ACTION);
    toolBar.addSeparator();
    toolBar.add(CLEAR_ACTION);
    getContentPane().add(toolBar, BorderLayout.NORTH);

    setSize(
        (int) Math.max(600, owner.getWidth() * 2.0d / 3.0d),
        (int) Math.max(400, owner.getHeight() * 2.0d / 3.0d));

    setLocationRelativeTo(owner);
  }
Beispiel #26
0
  @SuppressWarnings("deprecation")
  Runtime(JFrame app, KeyboardInput keyboard, MouseInput mouse) {
    window = app;
    window.setCursor(Cursor.CROSSHAIR_CURSOR);
    this.mouse = mouse;
    this.keyboard = keyboard;

    height = window.getHeight() - 20;
    width = window.getWidth();
  }
Beispiel #27
0
 public static void main(String[] args) {
   JFrame frame = new JFrame("Exercise01");
   JApplet applet = new Exercise01();
   frame.add(applet);
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setSize(640, 480);
   frame.setMinimumSize(new Dimension(frame.getWidth(), frame.getHeight()));
   frame.setLocationRelativeTo(null);
   frame.setVisible(true);
 }
Beispiel #28
0
  public MainMenu(javax.swing.JFrame mainFrame) {
    this.mainFrame = mainFrame;

    this.mainMenuPanel = new MainMenuPanel();
    this.mainMenuPanel.setSize(mainFrame.getWidth(), this.mainFrame.getHeight());
    this.mainMenuPanel.setLocation(0, 0);

    this.mainFrame.add(mainMenuPanel);
    this.mainFrame.repaint();
  }
    public void componentResized(ComponentEvent e) {
      Component c = e.getComponent();
      if (c == mainFrame) {
        JFrame theMainFrame = (JFrame) c;
        // update the range of samples to visualize
        //
        //
        //
        //				int newSampleCount = (int)Math.round((theMainFrame.getWidth() - frameWidth) *
        // samplePerPixel / 2);
        //
        //				Selection currSel = zoomStack.get(zoomStack.size() - 1);
        //				int newLeftSamples = Math.min(currSel.beginSelInSamples, newSampleCount);
        //				int leftRemainder = newSampleCount - newLeftSamples;
        //				int newRightSamples = Math.min(myHelper.getLengthInFrames() - currSel.endSelInSamples
        // +1 , newSampleCount);
        //				int rightRemainder = newSampleCount - newRightSamples;
        //				currSel.beginSelInSamples -= newLeftSamples;
        //				currSel.endSelInSamples += newRightSamples;
        //
        //
        //				if (leftRemainder > 0  && rightRemainder == 0) {
        //					newRightSamples = Math.min(myHelper.getLengthInFrames() - currSel.endSelInSamples +
        // 1, leftRemainder);
        //					currSel.endSelInSamples += newRightSamples;
        //				} else if (leftRemainder == 0 && rightRemainder > 0) {
        //					newLeftSamples = Math.min(currSel.beginSelInSamples, rightRemainder);
        //					currSel.beginSelInSamples -= newLeftSamples;
        //				}
        //
        //				System.err.println(currSel.beginSelInSamples + " " + currSel.endSelInSamples);
        //				selBeginSample = currSel.beginSelInSamples;
        //				selEndSample = currSel.endSelInSamples;

        // update the visualization area
        frameHeight = theMainFrame.getHeight();
        frameWidth = theMainFrame.getWidth();
        // his.overViewHeight = frameHeight / 10;
        waveHeight = frameHeight - overViewHeight - controlHeight;
        controlLocY = waveHeight + overViewHeight;
        zoomThresh = frameWidth / 20;
        stemThresh = frameWidth / 8;
        wavePanel.setSize(frameWidth, waveHeight);
        controlPanel.setBounds(0, controlLocY, frameWidth, controlHeight);
        overViewPanel.setSize(frameWidth, overViewHeight);
        wavePanel.refresh(
            false); // just refresh the view. wait till user calls refresh explicitly to update data
        overViewPanel.refresh();

        // samplePerPixel = (selEndSample - selBeginSample + 1) /frameWidth;

        mainFrame.validate();
      }
    }
Beispiel #30
0
  /**
   * Constructs a JToolBar that can be added to a JFrame
   *
   * @return a JToolBar
   */
  private JToolBar toolBar() {
    JToolBar toolbar = new JToolBar();
    JButton button;

    button = new JButton(images.loadImage("Images/toolbar/add_child_icon.png"));
    button.setToolTipText(lang_model.getValue(41));
    button.setFocusPainted(false);
    button.setActionCommand("newchild");
    button.addActionListener(this);
    toolbar.add(button);

    button = new JButton(images.loadImage("Images/toolbar/add_employee_icon.png"));
    button.setToolTipText(lang_model.getValue(147));
    button.setFocusPainted(false);
    button.setActionCommand("newemployee");
    button.addActionListener(this);
    toolbar.add(button);

    button = new JButton(images.loadImage("Images/toolbar/XML_icon_large.png"));
    button.setToolTipText(lang_model.getValue(148));
    button.setFocusPainted(false);
    button.setActionCommand("openfile");
    button.addActionListener(this);
    toolbar.add(button);

    button = new JButton(images.loadImage("Images/toolbar/calendar_icon_large.png"));
    button.setToolTipText(lang_model.getValue(149));
    button.setFocusPainted(false);
    button.setActionCommand("viewcalendar");
    button.addActionListener(this);
    button.setEnabled(false);
    toolbar.add(button);

    button = new JButton(images.loadImage("Images/toolbar/database_icon_large.png"));
    button.setToolTipText(lang_model.getValue(150));
    button.setFocusPainted(false);
    button.setActionCommand("viewdatabase");
    button.addActionListener(this);
    toolbar.add(button);

    button = new JButton(images.loadImage("Images/toolbar/finances_icon_large.png"));
    button.setToolTipText(lang_model.getValue(151));
    button.setFocusPainted(false);
    button.setActionCommand("viewfinances");
    button.addActionListener(this);
    button.setEnabled(false);
    toolbar.add(button);

    toolbar.setRollover(true);
    toolbar.setFloatable(false);
    toolbar.setSize(f.getWidth(), 15);

    return toolbar;
  }