Esempio n. 1
0
  /** Install Add and Remove Buttons into the toolbar */
  private void installAddRemovePointButtons() {
    URL imgURL = ClassLoader.getSystemResource("ch/tbe/pics/plus.gif");
    ImageIcon plus = new ImageIcon(imgURL);
    imgURL = ClassLoader.getSystemResource("ch/tbe/pics/minus.gif");
    ImageIcon minus = new ImageIcon(imgURL);
    add = new JButton(plus);
    rem = new JButton(minus);
    add.setToolTipText(workingViewLabels.getString("plus"));
    rem.setToolTipText(workingViewLabels.getString("minus"));
    add.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            WorkingView.this.addRemovePoint(true);
          }
        });
    rem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            WorkingView.this.addRemovePoint(false);
          }
        });

    add.setContentAreaFilled(false);
    add.setBorderPainted(false);
    rem.setContentAreaFilled(false);
    rem.setBorderPainted(false);
    toolbar.add(add);
    toolbar.add(rem);
  }
Esempio n. 2
0
  public JButton ButtonProperties(JButton button, String buttonText) {

    button.setFont(componentFont);
    button.setBorderPainted(false);
    button.setFocusPainted(false);
    button.setBackground(themeColor1);
    button.setForeground(themeColor4);
    button.setVerticalTextPosition(SwingConstants.BOTTOM);
    button.setHorizontalTextPosition(SwingConstants.CENTER);
    button.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseEntered(MouseEvent e) {

            button.setBackground(themeColor2);
            button.setForeground(Color.BLACK);
            button.setText(buttonText);
          }

          @Override
          public void mouseExited(MouseEvent e) {

            button.setBackground(themeColor1);
            button.setForeground(themeColor4);
            button.setText("");
          }
        });
    return button;
  }
Esempio n. 3
0
  /**
   * Installs a Tool in the Toolbar
   *
   * @param toolbar as JToolbar
   * @param tool, Tool to install
   */
  public void installToolInToolBar(JToolBar toolbar, final Tool tool) {
    final JButton button;
    button = new JButton();

    button.setMargin(new Insets(0, 0, 0, 0));

    if (tool.getItemType() != null) {
      button.setIcon(tool.getItemType().getIcon());
      button.setToolTipText(tool.getItemType().getDescription());

    } else {
      button.setText("Tool"); // For Debugging
    }
    toolbar.add(button);
    toolButtons.add(button);
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            WorkingView.this.setTool(tool, button);
          }
        });
    button.setContentAreaFilled(false);
    button.setBorderPainted(false);
    button.addMouseListener(
        new MouseAdapter() {
          public void mouseEntered(MouseEvent e) {
            ((JButton) e.getSource()).setBorderPainted(true);
          }

          public void mouseExited(MouseEvent e) {
            ((JButton) e.getSource()).setBorderPainted(false);
          }
        });
  }
Esempio n. 4
0
  public JButton ButtonProperties(JButton button) {

    button.setFont(componentFont);
    button.setBorderPainted(false);
    button.setFocusPainted(false);
    button.setBackground(themeColor1);
    button.setForeground(themeColor4);
    button.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseEntered(MouseEvent e) {

            button.setBackground(themeColor2);
            button.setForeground(Color.BLACK);
          }

          @Override
          public void mouseExited(MouseEvent e) {

            button.setBackground(themeColor1);
            button.setForeground(themeColor4);
          }
        });
    return button;
  }
 private void initButton(JButton button) {
   button.setText("");
   button.setBorder(RAISED_BORDER);
   button.setBorderPainted(false);
   button.setFocusPainted(false);
   button.setHorizontalAlignment(SwingConstants.CENTER);
   button.setVerticalAlignment(SwingConstants.CENTER);
 }
Esempio n. 6
0
 /**
  * _more_
  *
  * @param type
  * @return _more_
  */
 private JButton createButton(SpinIcon.Type type) {
   SpinIcon icon = new SpinIcon(type);
   JButton butt = new JButton(icon);
   Insets i = new Insets(0, 0, 0, 0);
   butt.setMargin(i);
   butt.setBorderPainted(false);
   butt.setFocusPainted(false);
   butt.setPreferredSize(new Dimension(icon.getIconWidth() + 2, icon.getIconHeight() + 2));
   return butt;
 }
Esempio n. 7
0
  public Abschluss(String wahl, Sudoku s, Sudoku2 s2) {
    super("Sudoku-Abschluss");
    this.setSize(270, 135);
    this.setLocation(250, 300);
    this.setLayout(null);
    this.setAlwaysOnTop(true);
    this.setResizable(false);
    this.setUndecorated(true);
    if (s == null) this.setLocationRelativeTo(s2);
    else this.setLocationRelativeTo(s);

    su = s;
    su2 = s2;
    w = wahl;

    ImageIcon icon = new ImageIcon("files/minigames/Sudoku/beispiel2.jpg");
    icon.setImage(icon.getImage().getScaledInstance(290, 135, Image.SCALE_DEFAULT));

    lab = new JLabel(icon);
    lab.setSize(270, 135);
    lab.setLocation(0, 0);
    this.add(lab);

    text = new JLabel();
    text.setSize(250, 20);
    text.setLocation(10, 10);
    text.setForeground(Color.white);
    text.setHorizontalAlignment(0);
    lab.add(text);

    text2 = new JLabel();
    text2.setSize(270, 20);
    text2.setLocation(10, 30);
    text2.setForeground(Color.white);
    lab.add(text2);

    ok = new JButton("OK");
    ok.setSize(90, 30);
    ok.setLocation(80, 50);
    ok.setBorderPainted(false);
    ok.setBackground(Color.lightGray);
    ok.setForeground(Color.lightGray);
    ok.setOpaque(false);
    ok.setFont(new Font("Arial Black", 4, 20));
    ok.setContentAreaFilled(false);
    ok.setFocusPainted(false);
    ok.addActionListener(this);
    ok.addMouseListener(this);
    lab.add(ok);

    textWahl(wahl);

    this.setVisible(true);
  }
Esempio n. 8
0
    /**
     * Constructor.
     *
     * @param title the title of the tab component
     * @param editor the editor of the tab (used to close the tab)
     */
    public TabComponent(final AbstractEditorPanel editor) {

      setLayout(new BorderLayout());
      setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0));
      setOpaque(false);

      // title
      title = new JLabel(editor.getTitle());
      title.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
      add(title, BorderLayout.WEST);

      // close
      final JButton close = new JButton(Project.getEditorImageIconOrEmpty("icon_cross.png"));
      close.setPreferredSize(new Dimension(16, 16));
      close.setUI(new BasicButtonUI());
      close.setBorderPainted(false);
      close.setOpaque(false);
      close.addActionListener(
          new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
              removeEditor(editor, true);
            }
          });
      close.addMouseListener(
          new MouseListener() {

            @Override
            public void mouseClicked(MouseEvent me) {}

            @Override
            public void mousePressed(MouseEvent me) {}

            @Override
            public void mouseReleased(MouseEvent me) {}

            @Override
            public void mouseEntered(MouseEvent me) {

              close.setBorderPainted(true);
            }

            @Override
            public void mouseExited(MouseEvent me) {

              close.setBorderPainted(false);
            }
          });
      add(close, BorderLayout.EAST);
    }
  public BorderedComponent(String text, JComponent comp, boolean collapsible) {
    super(null);

    this.comp = comp;

    // Only add border if text is not null
    if (text != null) {
      TitledBorder border;
      if (collapsible) {
        final JLabel textLabel = new JLabel(text);
        JPanel borderLabel =
            new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0)) {
              public int getBaseline(int w, int h) {
                Dimension dim = textLabel.getPreferredSize();
                return textLabel.getBaseline(dim.width, dim.height) + textLabel.getY();
              }
            };
        borderLabel.add(textLabel);
        border = new LabeledBorder(borderLabel);
        textLabel.setForeground(border.getTitleColor());

        if (IS_WIN) {
          collapseIcon = new ImageIcon(getImage("collapse-winlf"));
          expandIcon = new ImageIcon(getImage("expand-winlf"));
        } else {
          collapseIcon = new ArrowIcon(SOUTH, textLabel);
          expandIcon = new ArrowIcon(EAST, textLabel);
        }

        moreOrLessButton = new JButton(collapseIcon);
        moreOrLessButton.setContentAreaFilled(false);
        moreOrLessButton.setBorderPainted(false);
        moreOrLessButton.setMargin(new Insets(0, 0, 0, 0));
        moreOrLessButton.addActionListener(this);
        String toolTip = Messages.BORDERED_COMPONENT_MORE_OR_LESS_BUTTON_TOOLTIP;
        moreOrLessButton.setToolTipText(toolTip);
        borderLabel.add(moreOrLessButton);
        borderLabel.setSize(borderLabel.getPreferredSize());
        add(borderLabel);
      } else {
        border = new TitledBorder(text);
      }
      setBorder(new CompoundBorder(new FocusBorder(this), border));
    } else {
      setBorder(new FocusBorder(this));
    }
    if (comp != null) {
      add(comp);
    }
  }
Esempio n. 10
0
 /**
  * The class constructor.
  *
  * <p>Adds and creates a message saying bye.
  */
 public Instruction2() {
   setLayout(null);
   JButton back = new JButton(new ImageIcon("Back.png"));
   back.setOpaque(false);
   back.setContentAreaFilled(false);
   back.setBorderPainted(false);
   back.setFocusable(false);
   back.setRolloverIcon(new ImageIcon("Backrollover.png"));
   back.setActionCommand("Back");
   back.addActionListener(this);
   JLabel pic = new JLabel(new ImageIcon("Instructions2.png"));
   pic.setBounds(0, 0, pic.getPreferredSize().width, pic.getPreferredSize().height);
   back.setBounds(5, 200, back.getPreferredSize().width, back.getPreferredSize().height);
   add(pic);
   add(back);
 }
  public void setUseFlatUI(boolean b) {
    main.setContentAreaFilled(!b);
    main.setFocusPainted(!b);
    main.setBorderPainted(!b);
    main.setMargin(new Insets(1, 1, 1, 1));

    popper.setContentAreaFilled(!b);
    popper.setFocusPainted(!b);
    popper.setBorderPainted(!b);
    popper.setMargin(new Insets(1, 1, 1, 1));

    setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
    setOpaque(false);

    MouseAdapter ma =
        new MouseAdapter() {
          public void mouseEntered(MouseEvent e) {
            main.setContentAreaFilled(true);
            main.setBackground(new Color(216, 240, 254));
            // m.getMainButton().setForeground( Color.black );
            setBorder(new LineBorder(new Color(200, 200, 200), 1));
            setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

            popper.setBackground(new Color(242, 242, 242));
            popper.setContentAreaFilled(true);
            popper.setBorder(menu.getBorder());
          }

          public void mouseExited(MouseEvent e) {
            main.setContentAreaFilled(false);
            //	c.setForeground( Color.black );
            setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
            setCursor(Cursor.getDefaultCursor());

            popper.setContentAreaFilled(false);
            popper.setBorder(null);
          }
        };

    main.addMouseListener(ma);
    popper.addMouseListener(ma);
  }
Esempio n. 12
0
  Spacer(ZoneModel model, int index, SpacerHandle knobHandle) {
    this.model = model;
    this.index = index;
    this.knobHandle = knobHandle;

    knobPainter = new KnobPainter(this);

    setOpaque(false);
    setCursor(SliderCursor);

    initKeyMaps();

    Icon icon = getIcon("unstick");
    Icon pressedIcon = getIcon("unstickPressed");
    Icon highlightIcon = getIcon("unstickHighlight");
    unstickButton = new JButton(icon);
    unstickButton.setSize(icon.getIconWidth(), icon.getIconHeight());
    unstickButton.setPressedIcon(pressedIcon);
    unstickButton.setRolloverEnabled(true);
    unstickButton.setRolloverIcon(highlightIcon);
    unstickButton.setBorder(null);
    unstickButton.putClientProperty(SubstanceLookAndFeel.BUTTON_PAINT_NEVER_PROPERTY, Boolean.TRUE);
    unstickButton.setBorderPainted(false);
    unstickButton.setRolloverEnabled(true);
    unstickButton.setOpaque(false);
    unstickButton.setCursor(ClickCursor);
    unstickButton.setFocusable(false);
    unstickButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            Spacer.this.model.removePoint(Spacer.this.index);
          }
        });
    if (model.containsPoint(index)) {
      add(unstickButton);
    }
    model.addZoneModelListener(this);

    setFocusable(true);
    addFocusListener(this);
    addMouseListener(this);
  }
Esempio n. 13
0
  public void showColorButtons() {

    Color colors[] = {Color.RED, Color.BLACK, Color.WHITE, Color.GREEN, Color.YELLOW, Color.BLUE};
    Insets in = this.getInsets();

    this.input = new JTextField();
    this.add(this.input);
    this.input.setBounds(100 + in.left, 36 + in.top, 200, 30);

    int arrayAmount = numberOfPlayersButtons.size();

    for (int i = 0; i < numberOfPlayersButtons.size(); i++) {

      this.remove(numberOfPlayersButtons.get(i));
    }

    numberOfPlayersButtons = null;

    arrayAmount = this.maxPlayersAmount;

    for (int i = 0; i < arrayAmount; i++) {

      JButton tempButton = new JButton();
      colorButtons.add(tempButton);

      tempButton.setBackground(colors[i]);
      tempButton.setBorderPainted(false);
      tempButton.setOpaque(true);
      tempButton.setBounds(65 + i * 45 + in.left, 81 + in.top, 25, 25);
      tempButton.addActionListener(this.listener);

      this.add(tempButton);
    }

    Dimension size;

    size = label.getPreferredSize();
    label.setBounds(65, 5 + in.top, size.width + 48, size.height);

    label.setText("Jogador 1, informe a sua cor e o seu nome:");
    this.repaint();
  }
 private void setLookLowered(JButton button) {
   button.setBorder(LOWERED_BORDER);
   button.setHorizontalAlignment(SwingConstants.RIGHT);
   button.setVerticalAlignment(SwingConstants.BOTTOM);
   button.setBorderPainted(true);
 }
 private void setLookRaised(JButton button) {
   button.setBorder(RAISED_BORDER);
   button.setHorizontalAlignment(SwingConstants.CENTER);
   button.setVerticalAlignment(SwingConstants.CENTER);
   button.setBorderPainted(true);
 }
Esempio n. 16
0
  /*
   * main constructor
   * @param debug - boolean for debug mode
   */
  public boardPanel(boolean debug) {
    // initial constructor
    super();
    debugBoardPanel = debug;

    // continue defining boardPanel
    this.setLayout(new GridBagLayout());
    cons.fill = GridBagConstraints.BOTH;
    cons.insets = new Insets(0, 0, 0, 0);
    cons.anchor = GridBagConstraints.FIRST_LINE_START;
    this.setVisible(true);

    // button preferred size
    Dimension btnSize = new Dimension(25, 25);

    // top row
    // ------------------------------------------------------------------------------------------
    // spa
    btnSpa = new JButton("Spa");
    allRooms[0] = btnSpa;
    btnSpa.setPreferredSize(btnSize);
    cons.gridx = 0;
    cons.gridy = 0;
    cons.gridwidth = 5;
    cons.gridheight = 5;
    btnSpa.setBackground(defaultRoomColor);
    btnSpa.setOpaque(true);
    btnSpa.setBorderPainted(false);
    btnSpa.addActionListener(new myActionListener());
    this.add(btnSpa, cons);

    // space buttons
    for (int y = 0; y < 5; y++) {
      for (int x = 5; x < 10; x++) {
        createBlankButtons(x, y, btnSize);
      }
    }

    // theater
    btnTheater = new JButton("Theater");
    allRooms[1] = btnTheater;
    btnTheater.setPreferredSize(btnSize);
    cons.gridx = 10;
    cons.gridy = 0;
    cons.gridwidth = 5;
    cons.gridheight = 5;
    btnTheater.setOpaque(true);
    btnTheater.setBorderPainted(false);
    btnTheater.setBackground(defaultRoomColor);
    btnTheater.addActionListener(new myActionListener());
    this.add(btnTheater, cons);

    // space buttons
    for (int y = 0; y < 5; y++) {
      for (int x = 15; x < 20; x++) {
        createBlankButtons(x, y, btnSize);
      }
    }

    // Living Room
    btnLivingRoom = new JButton("Living Room");
    allRooms[2] = btnLivingRoom;
    btnLivingRoom.setPreferredSize(btnSize);
    cons.gridx = 20;
    cons.gridy = 0;
    cons.gridwidth = 5;
    cons.gridheight = 5;
    btnLivingRoom.setBackground(defaultRoomColor);
    btnLivingRoom.setOpaque(true);
    btnLivingRoom.setBorderPainted(false);
    btnLivingRoom.addActionListener(new myActionListener());
    this.add(btnLivingRoom, cons);

    // space buttons
    for (int y = 0; y < 5; y++) {
      for (int x = 25; x < 30; x++) {
        createBlankButtons(x, y, btnSize);
      }
    }

    // observatory
    btnObservatory = new JButton("Observatory");
    allRooms[3] = btnObservatory;
    btnObservatory.setPreferredSize(btnSize);
    cons.gridx = 30;
    cons.gridy = 0;
    cons.gridwidth = 5;
    cons.gridheight = 5;
    btnObservatory.setBackground(defaultRoomColor);
    btnObservatory.setOpaque(true);
    btnObservatory.setBorderPainted(false);
    btnObservatory.addActionListener(new myActionListener());
    this.add(btnObservatory, cons);

    // top to middle spaces
    // ------------------------------------------------------------------------------------------

    // space buttons
    for (int y = 5; y < 10; y++) {
      for (int x = 0; x < 35; x++) {
        createBlankButtons(x, y, btnSize);
      }
    }

    // middle row
    // ------------------------------------------------------------------------------------------

    // Patio
    btnPatio = new JButton("Patio");
    allRooms[4] = btnPatio;
    btnPatio.setPreferredSize(btnSize);
    cons.gridx = 0;
    cons.gridy = 10;
    cons.gridwidth = 5;
    cons.gridheight = 5;
    btnPatio.setBackground(defaultRoomColor);
    btnPatio.setOpaque(true);
    btnPatio.setBorderPainted(false);
    btnPatio.addActionListener(new myActionListener());
    this.add(btnPatio, cons);

    // space buttons
    for (int y = 10; y < 15; y++) {
      for (int x = 5; x < 10; x++) {
        createBlankButtons(x, y, btnSize);
      }
    }

    // pool
    btnPool = new JButton("Pool");
    allRooms[5] = btnPool;
    btnPool.setPreferredSize(btnSize);
    cons.gridx = 10;
    cons.gridy = 10;
    cons.gridwidth = 15;
    cons.gridheight = 5;
    btnPool.setBackground(defaultPoolColor);
    btnPool.setOpaque(true);
    btnPool.setBorderPainted(false);
    btnPool.addActionListener(new myActionListener());
    this.add(btnPool, cons);

    // space buttons
    for (int y = 10; y < 15; y++) {
      for (int x = 25; x < 30; x++) {
        createBlankButtons(x, y, btnSize);
      }
    }

    // Hall
    btnHall = new JButton("Hall");
    allRooms[6] = btnHall;
    btnHall.setPreferredSize(btnSize);
    cons.gridx = 30;
    cons.gridy = 10;
    cons.gridwidth = 5;
    cons.gridheight = 5;
    btnHall.setBackground(defaultRoomColor);
    btnHall.setOpaque(true);
    btnHall.setBorderPainted(false);
    btnHall.addActionListener(new myActionListener());
    this.add(btnHall, cons);

    // middle to bottom spaces
    // ------------------------------------------------------------------------------------------

    // space buttons
    for (int y = 15; y < 20; y++) {
      for (int x = 0; x < 35; x++) {
        createBlankButtons(x, y, btnSize);
      }
    }

    // bottom row
    // ------------------------------------------------------------------------------------------

    // Kitchen
    btnKitchen = new JButton("Kitchen");
    allRooms[7] = btnKitchen;
    btnKitchen.setPreferredSize(btnSize);
    cons.gridx = 0;
    cons.gridy = 20;
    cons.gridwidth = 5;
    cons.gridheight = 5;
    btnKitchen.setBackground(defaultRoomColor);
    btnKitchen.setOpaque(true);
    btnKitchen.setBorderPainted(false);
    btnKitchen.addActionListener(new myActionListener());
    this.add(btnKitchen, cons);

    // space buttons
    for (int y = 20; y < 25; y++) {
      for (int x = 5; x < 10; x++) {
        createBlankButtons(x, y, btnSize);
      }
    }

    // dining room
    btnDiningRoom = new JButton("Dining Room");
    allRooms[8] = btnDiningRoom;
    btnPool.setPreferredSize(btnSize);
    cons.gridx = 10;
    cons.gridy = 20;
    cons.gridwidth = 15;
    cons.gridheight = 5;
    btnDiningRoom.setBackground(defaultRoomColor);
    btnDiningRoom.setOpaque(true);
    btnDiningRoom.setBorderPainted(false);
    btnDiningRoom.addActionListener(new myActionListener());
    this.add(btnDiningRoom, cons);

    // space buttons
    for (int y = 20; y < 25; y++) {
      for (int x = 25; x < 30; x++) {
        createBlankButtons(x, y, btnSize);
      }
    }

    // Guest House
    btnGuestHouse = new JButton("Guest House");
    allRooms[9] = btnGuestHouse;
    btnGuestHouse.setPreferredSize(btnSize);
    cons.gridx = 30;
    cons.gridy = 20;
    cons.gridwidth = 5;
    cons.gridheight = 5;
    btnGuestHouse.setBackground(defaultRoomColor);
    btnGuestHouse.setOpaque(true);
    btnGuestHouse.setBorderPainted(false);
    btnGuestHouse.addActionListener(new myActionListener());
    this.add(btnGuestHouse, cons);

    // textArea
    // ------------------------------------------------------------------------------------------

    // create textarea for output
    cons.gridx = 0;
    cons.gridy = 25;
    cons.gridwidth = 35;
    this.add(jsp, cons);
  }
Esempio n. 17
0
  // gui constructor
  public Gui() throws IOException {

    // sets frame text and features
    super("Doge Clicker 1.0");
    this.setIconImage(new ImageIcon("Images//doge.jpg").getImage());

    // initializes sound files
    Sounds.initialize();

    // gui dimensions and features
    setSize(1000, 700);
    setResizable(false);
    setLayout(null);
    Container c = getContentPane();
    c.setBackground(new Color(255, 255, 255));
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    // timer for doge per second run method runs every millisecond
    timer = new Timer();
    timer.schedule(new RemindTask(), 1000, 10);

    // bolded title
    title = new JLabel("Doge Clicker v1.0");
    title.setBounds(0, 0, getWidth(), 40);
    title.setFont(new Font("Comic Sans MS", Font.BOLD, 26));
    title.setForeground(Color.white);
    title.setHorizontalAlignment(JLabel.CENTER);
    add(title);

    // reads news.txt to have import text to array
    String filePath = "Data\\news.txt";
    BufferedReader fileIn = new BufferedReader(new FileReader(filePath));
    for (int i = 0; i < line.length; i++) {

      // reads lines and saves until done reading
      if ((line[i] = fileIn.readLine()) != null) {}
    }
    fileIn.close(); // close file

    // read flavor text.txt to import text to array
    filePath = "Data\\flavourtext.txt";
    fileIn = new BufferedReader(new FileReader(filePath));
    for (int i = 0; i < flavourText.length; i++) {

      // reads lines until complety reading
      if ((flavourText[i] = fileIn.readLine()) != null) {}
    }
    fileIn.close();

    // flavour label that pops up randomly when doge is clicked
    flavourClick = new JLabel("Wow! Such click!");
    flavourClick.setBounds(400, 100, getWidth(), getHeight());
    flavourClick.setFont(new Font("Comic Sans MS", Font.BOLD, 25));
    flavourClick.setForeground(Color.white);
    flavourClick.setOpaque(false);
    add(flavourClick);

    // label for achievements
    achievementText = new JLabel("These are your achievements");
    achievementText.setBounds(75, 2, getWidth(), 15);
    achievementText.setFont(new Font("Comic Sans MS", Font.BOLD, 13));
    achievementText.setForeground(Color.white);
    add(achievementText);

    // label for doge buying and click upgrades
    dogeProducers = new JLabel("Buy to make more doge");
    dogeProducers.setBounds(50, 160, getWidth(), 40);
    dogeProducers.setFont(new Font("Comic Sans MS", Font.BOLD, 13));
    dogeProducers.setForeground(Color.white);
    add(dogeProducers);
    dogeClickers = new JLabel("Miscellaneous upgrades wow");
    dogeClickers.setBounds(700, 160, getWidth(), 40);
    dogeClickers.setFont(new Font("Comic Sans MS", Font.BOLD, 13));
    dogeClickers.setForeground(Color.white);
    add(dogeClickers);

    // doge click button
    dogeClick = new JButton(new ImageIcon("Images/doge.jpg"));
    dogeClick.addActionListener(this);
    dogeClick.setBounds(450, 100, 100, 100);
    dogeClick.setOpaque(false);
    dogeClick.setBorder(BorderFactory.createLineBorder(Color.black));
    dogeClick.setToolTipText("Each click gives you " + clickUpgrade + " doge. wow");
    add(dogeClick);

    // click multiplier
    clickMultiplier = new JLabel(multiplier + "x");
    clickMultiplier.setBounds(570, 120, getWidth(), 50);
    clickMultiplier.setFont(new Font("Comic Sans MS", Font.BOLD, 30));
    clickMultiplier.setForeground(Color.white);
    add(clickMultiplier);
    // clicks per second indicator
    cpsIndicator = new JLabel(cps + " clicks per second");
    cpsIndicator.setBounds(570, 150, getWidth(), 50);
    cpsIndicator.setFont(new Font("Comic Sans MS", Font.BOLD, 10));
    cpsIndicator.setForeground(Color.white);
    add(cpsIndicator);

    // event indicator
    eventIndicator = new JLabel("Welcome to doge clicker!");
    eventIndicator.setBounds(700, 530, getWidth(), 50);
    eventIndicator.setFont(new Font("Comic Sans MS", Font.BOLD, 15));
    eventIndicator.setForeground(Color.white);
    add(eventIndicator);

    // states the num of doge and doge per second
    dogeCount = new JLabel("Doge: " + doge);
    dogeCount.setBounds(0, 0, getWidth(), 120);
    dogeCount.setFont(new Font("Comic Sans MS", Font.BOLD, 20));
    dogeCount.setForeground(Color.white);
    dogeCount.setHorizontalAlignment(JLabel.CENTER);
    add(dogeCount);
    dogePerSecond = new JLabel("You get " + dps + " doge per second");
    dogePerSecond.setBounds(0, 25, getWidth(), 120);
    dogePerSecond.setFont(new Font("Comic Sans MS", Font.BOLD, 11));
    dogePerSecond.setForeground(Color.white);
    dogePerSecond.setHorizontalAlignment(JLabel.CENTER);
    add(dogePerSecond);
    dogeClicktext = new JLabel("Click for more doge");
    dogeClicktext.setBounds(400, 185, 200, 50);
    dogeClicktext.setFont(new Font("Comic Sans MS", Font.BOLD, 13));
    dogeClicktext.setForeground(Color.white);
    dogeClicktext.setHorizontalAlignment(JLabel.CENTER);
    add(dogeClicktext);
    // doge button testing button
    devButton = new JButton(new ImageIcon());
    devButton.addActionListener(this);
    devButton.setBounds(0, 0, 50, 50);
    devButton.setToolTipText("Such Secret");
    devButton.setOpaque(false);
    devButton.setContentAreaFilled(false);
    devButton.setBorderPainted(false);
    add(devButton);

    // options and save buttons
    options = new JButton(new ImageIcon("Images/option.png"));
    options.addActionListener(this);
    options.setBounds(900, 10, 70, 70);
    options.setOpaque(false);
    options.setBorder(BorderFactory.createLineBorder(Color.black));
    options.setToolTipText("Go to options");
    add(options);
    save = new JButton(new ImageIcon("Images/save.png"));
    save.addActionListener(this);
    save.setBounds(820, 10, 70, 70);
    save.setOpaque(false);
    save.setBorder(BorderFactory.createLineBorder(Color.black));
    save.setToolTipText("Save a file");
    add(save);
    open = new JButton(new ImageIcon("Images/open.png"));
    open.addActionListener(this);
    open.setBounds(740, 10, 70, 70);
    open.setOpaque(false);
    open.setBorder(BorderFactory.createLineBorder(Color.black));
    open.setToolTipText("Open a file");
    add(open);

    // news headline label that will move
    for (int i = 0; i < 3; i++) {

      newsHeadline[i] = new JLabel("Welcome to Doge clicker this is a news headline!");
      newsHeadline[i].setBounds(-200 - (475 * i), 615, getWidth(), 40);
      newsHeadline[i].setFont(new Font("Comic Sans MS", Font.BOLD, 13));
      newsHeadline[i].setForeground(Color.white);
      add(newsHeadline[i]);
    }

    // create all buttons and button stats and labels for producers
    for (int i = 0; i < MAX_UPGRADES; i++) {

      producerStats[i] = new Producers(i);
      producers[i] = new JButton(new ImageIcon(producerStats[i].getImage()));
      producers[i].addActionListener(this);
      producers[i].setOpaque(false);
      producers[i].setBorder(BorderFactory.createLineBorder(Color.black));
      producers[i].setToolTipText(
          "Your "
              + producerStats[i].getButtonName()
              + " gives "
              + producerStats[i].getDogeProduction() * producerStats[i].getCount()
              + " doge per second");
      producers[i].setBounds(0, 0, 70, 70);

      buyProducers[i] =
          new JLabel(
              "Buy "
                  + producerStats[i].getButtonName()
                  + " for "
                  + producerStats[i].getCost()
                  + " doge");
      buyProducers[i].setBounds(0, 0, getWidth(), 100);
      buyProducers[i].setFont(new Font("Comic Sans MS", Font.PLAIN, 12));
      buyProducers[i].setForeground(Color.white);

      buyDetails[i] =
          new JLabel(
              "You have: " + producerStats[i].getCount() + " " + producerStats[i].getButtonName());
      buyDetails[i].setBounds(0, 0, getWidth(), 100);
      buyDetails[i].setFont(new Font("Comic Sans MS", Font.PLAIN, 12));
      buyDetails[i].setForeground(Color.white);
    }
    // buttons and labels for click upgrades clickers
    for (int i = 0; i < MAX_CLICK; i++) {

      clickerStats[i] = new Clickers(i);
      clickers[i] = new JButton(new ImageIcon(clickerStats[i].getImage()));
      clickers[i].addActionListener(this);
      if (clickerStats[i].getClickMultiplier() == 1) {
        clickers[i].setToolTipText(
            "Buy this "
                + clickerStats[i].getButtonName()
                + " to get +"
                + clickerStats[i].getClickBonus()
                + " doge per click");
      } else {
        clickers[i].setToolTipText(
            "Buy this "
                + clickerStats[i].getButtonName()
                + " to get x"
                + clickerStats[i].getClickMultiplier()
                + " doge per click");
      }
      clickers[i].setOpaque(false);
      clickers[i].setBorder(BorderFactory.createLineBorder(Color.black));
      clickers[i].setBounds(0, 0, 70, 70);

      buyClickers[i] =
          new JLabel(
              "Buy "
                  + clickerStats[i].getButtonName()
                  + " for "
                  + clickerStats[i].getCost()
                  + " doge");
      buyClickers[i].setBounds(0, 0, getWidth(), 100);
      buyClickers[i].setFont(new Font("Comic Sans MS", Font.PLAIN, 12));
      buyClickers[i].setForeground(Color.white);
    }

    // labels for achievements
    for (int i = 0; i < MAX_ACHIEVEMENTS; i++) {
      achievementStats[i] = new Achievements(i);
      achievements[i] = new JLabel(new ImageIcon(achievementStats[i].getImage()));
      achievements[i].setBorder(BorderFactory.createLineBorder(Color.black));
      achievements[i].setToolTipText("Achievement: " + achievementStats[i].getButtonName());
      achievements[i].setBounds(0, 0, 70, 70);
    }

    // JPanel containing achievements
    JPanel achievementPanel = new JPanel();
    achievementPanel.setPreferredSize(new Dimension(350, 70));
    achievementPanel.setLayout(null);
    achievementPanel.setOpaque(false);

    // JScrollpane containing JPanel for achievements
    JScrollPane achievementDisplay = new JScrollPane();
    achievementDisplay.setViewportBorder(new LineBorder(Color.black));
    achievementDisplay.setSize(280, 90);
    achievementDisplay.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    achievementDisplay.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    achievementDisplay.getVerticalScrollBar().setUnitIncrement(10);
    achievementDisplay.setLocation(50, 20);
    achievementDisplay.setOpaque(false);
    add(achievementDisplay);

    // adds the panel
    achievementDisplay.getViewport().add(achievementPanel);
    achievementDisplay.getViewport().setOpaque(false);

    // adds all achievements
    for (int i = 0; i < MAX_ACHIEVEMENTS; i++) {

      achievementPanel.add(achievements[i]);
      achievements[i].setLocation(0 + i * 70, 0);
      achievements[i].setVisible(false);
    }

    // jpanel containing upgrades for producers
    JPanel upgradePanel = new JPanel();
    upgradePanel.setPreferredSize(new Dimension(350, 770));
    upgradePanel.setLayout(null);
    upgradePanel.setOpaque(false);

    // Jscrollpane containing jpanel for producers
    JScrollPane producerUpgrades = new JScrollPane();
    producerUpgrades.setViewportBorder(new LineBorder(Color.black));
    producerUpgrades.setSize(350, 300);
    producerUpgrades.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    producerUpgrades.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    producerUpgrades.getVerticalScrollBar().setUnitIncrement(10);
    producerUpgrades.setLocation(0, 200);
    producerUpgrades.setOpaque(false);
    add(producerUpgrades);

    producerUpgrades.getViewport().setOpaque(false);
    producerUpgrades.getViewport().add(upgradePanel);

    // adds all upgrades
    for (int i = 0; i < MAX_UPGRADES; i++) {

      upgradePanel.add(producers[i]);
      producers[i].setLocation(0, (i) * 70);
      upgradePanel.add(buyProducers[i]);
      buyProducers[i].setLocation(90, (i * 70) - 35);
      upgradePanel.add(buyDetails[i]);
      buyDetails[i].setLocation(90, (i * 70) - 20);
    }

    // jpanel containing upgrades for clickers
    JPanel clickPanel = new JPanel();
    clickPanel.setPreferredSize(new Dimension(350, 350));
    clickPanel.setLayout(null);
    clickPanel.setOpaque(false);

    // Jscrollpane containing jpanel for clickers
    JScrollPane clickUpgrades = new JScrollPane();
    clickUpgrades.setViewportBorder(new LineBorder(Color.black));
    clickUpgrades.setSize(350, 300);
    clickUpgrades.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    clickUpgrades.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    clickUpgrades.getVerticalScrollBar().setUnitIncrement(10);
    clickUpgrades.setLocation(650, 200);
    clickUpgrades.setOpaque(false);
    add(clickUpgrades);
    clickUpgrades.getViewport().add(clickPanel);
    clickUpgrades.getViewport().setOpaque(false);

    // adds all click upgrades
    for (int i = 0; i < MAX_CLICK; i++) {

      clickPanel.add(clickers[i]);
      clickers[i].setLocation(0, (i) * 70);
      clickPanel.add(buyClickers[i]);
      buyClickers[i].setLocation(80, (i * 70) - 30);
    }

    // dancing snoop dog image
    JLabel snoop = new JLabel(new ImageIcon("Images//snoop.gif"));
    snoop.setBounds(450, 370, 150, 308);
    snoop.setOpaque(false);
    add(snoop);

    // background image
    JLabel background = new JLabel(new ImageIcon("Images//dogebackground.png"));
    background.setBounds(0, 0, 1000, 700);
    add(background);

    // makes everything above visible
    setVisible(true);
    // flavour click will remain invisible
    flavourClick.setVisible(false);

    // timer for news headline, runs every 20 milliseconds
    MyTimerTask task = new MyTimerTask();
    Timer newsTimer = new Timer();
    newsTimer.scheduleAtFixedRate(task, 0, 20);
  }
Esempio n. 18
0
  public SmartToolBar(RuntimeConfigFrame fr) {
    frame = fr;
    setFloatable(true);
    treeCombo = new TreeCombo(frame.model);
    treeCombo.addActionListener(new ComboListener());
    treeCombo.setPreferredSize(new Dimension(210, 25));
    treeCombo.setMinimumSize(new Dimension(210, 25));
    treeCombo.setMaximumSize(new Dimension(210, 25));
    add(treeCombo);
    addSeparator();
    addSeparator();
    addSeparator();

    ToolBarAction toolBarAction = new ToolBarAction();
    JButton saveAsButton = add(toolBarAction);
    ImageIcon icon =
        frame
            .getCommonBuilderUIImpl()
            .getScaledImage("file.png", "images/runtimeadmin", 28, 28, Image.SCALE_DEFAULT);
    saveAsButton.setPreferredSize(new Dimension(28, 28));
    saveAsButton.setMinimumSize(new Dimension(28, 28));
    saveAsButton.setMaximumSize(new Dimension(28, 28));
    saveAsButton.setBorderPainted(false);
    saveAsButton.setIcon(icon);
    icon =
        frame
            .getCommonBuilderUIImpl()
            .getScaledImage("file_mo.png", "images/runtimeadmin", 28, 28, Image.SCALE_DEFAULT);
    saveAsButton.setRolloverIcon(icon);
    saveAsButton.setActionCommand("Apply To Server");
    saveAsButton.setToolTipText(RuntimeConfigFrame.getString("Apply To Server"));
    addSeparator();

    JButton close = add(toolBarAction);
    icon =
        frame
            .getCommonBuilderUIImpl()
            .getScaledImage("exit.png", "images/", 28, 28, Image.SCALE_DEFAULT);
    close.setPreferredSize(new Dimension(28, 28));
    close.setMinimumSize(new Dimension(28, 28));
    close.setMaximumSize(new Dimension(28, 28));
    close.setIcon(icon);
    close.setBorderPainted(false);
    icon =
        frame
            .getCommonBuilderUIImpl()
            .getScaledImage("exit_mo.png", "images/", 28, 28, Image.SCALE_DEFAULT);
    close.setRolloverIcon(icon);
    close.setActionCommand("Close");
    close.setToolTipText(RuntimeConfigFrame.getString("Close"));
    addSeparator();

    JButton help = add(toolBarAction);
    icon =
        frame
            .getCommonBuilderUIImpl()
            .getScaledImage("toolhelp.png", "images/", 28, 28, Image.SCALE_DEFAULT);
    help.setPreferredSize(new Dimension(28, 28));
    help.setMinimumSize(new Dimension(28, 28));
    help.setMaximumSize(new Dimension(28, 28));
    help.setBorderPainted(false);
    help.setIcon(icon);

    icon =
        frame
            .getCommonBuilderUIImpl()
            .getScaledImage("toolhelp_mo.png", "images/", 28, 28, Image.SCALE_DEFAULT);
    help.setRolloverIcon(icon);
    help.setActionCommand("Help Contents");
    help.setToolTipText(RuntimeConfigFrame.getString("Help"));
    // addSeparator();

  }
Esempio n. 19
0
  public IUmenu(String host) {

    setTitle("GUUERRA_NAVAL");
    efectos = new Efectos();
    try {
      cliente = new Cliente(host);
    } catch (Exception ex) {
    }

    /* Titulo */
    titulo = new JLabel(" JHONMAN ");
    titulo.setForeground(Color.BLACK);
    titulo.setFont(new Font("Algerian", Font.BOLD, 24));
    titulo.setBounds(120, 40, 560, 40);
    titulo.setHorizontalAlignment(JLabel.CENTER);

    /* MeEnu de Opciones */
    mEnU = new JLabel("MENU DE OPCIONES");
    mEnU.setForeground(Color.BLACK);
    mEnU.setFont(new Font("Algerian", Font.BOLD, 24));
    mEnU.setBounds(40, 135, 390, 40);
    mEnU.setHorizontalAlignment(JLabel.LEFT);

    ImageIcon i = new ImageIcon("imagenes/apariencia/fondo_def.jpg");
    fondo = new JLabel(new ImageIcon(i.getImage().getScaledInstance(800, 600, Image.SCALE_SMOOTH)));
    fondo.setBounds(0, 0, 800, 600);

    ImageIcon i1 = new ImageIcon("imagenes/apariencia/botRegistrar.jpg");
    ImageIcon i2 = new ImageIcon("imagenes/apariencia/botPrincipiante.jpg");
    ImageIcon i3 = new ImageIcon("imagenes/apariencia/botDificil.jpg");
    ImageIcon i4 = new ImageIcon("imagenes/apariencia/botSalir.jpg");
    ImageIcon i5 = new ImageIcon("imagenes/apariencia/botRaking.jpg");
    ImageIcon i6 = new ImageIcon("imagenes/apariencia/brJuegoRed2.jpg");
    ImageIcon i11 = new ImageIcon("imagenes/apariencia/botRegistrar2.jpg");
    ImageIcon i22 = new ImageIcon("imagenes/apariencia/botPrincipiante2.jpg");
    ImageIcon i33 = new ImageIcon("imagenes/apariencia/botDificil2.jpg");
    ImageIcon i44 = new ImageIcon("imagenes/apariencia/botSalir2.jpg");
    ImageIcon i55 = new ImageIcon("imagenes/apariencia/botRaking2.jpg");
    ImageIcon i66 = new ImageIcon("imagenes/apariencia/brJuegoRed.jpg");

    /* Boton Puntajes */
    estad =
        new JButton(new ImageIcon(i5.getImage().getScaledInstance(170, 40, Image.SCALE_SMOOTH)));
    estad.setBounds(98, 148, 170, 40);
    estad.setRolloverIcon(
        new ImageIcon(
            i55.getImage()
                .getScaledInstance(
                    170,
                    40,
                    Image
                        .SCALE_SMOOTH))); // cuando el mouse esta sobre el boton cambia a esta
                                          // imagen
    estad.setBorderPainted(false); // elimino los bordes de el boton
    estad.addActionListener(this);
    estad.setMnemonic(KeyEvent.VK_P);
    estad.setToolTipText("ver Raking ALT + P");

    /* Boton Registrar */
    registrar =
        new JButton(new ImageIcon(i1.getImage().getScaledInstance(170, 40, Image.SCALE_SMOOTH)));
    registrar.setBounds(98, 205, 170, 40);
    registrar.setRolloverIcon(
        new ImageIcon(i11.getImage().getScaledInstance(170, 40, Image.SCALE_SMOOTH)));
    registrar.setBorderPainted(false);
    registrar.addActionListener(this);
    registrar.setMnemonic(KeyEvent.VK_Q);
    registrar.setToolTipText("Registrarse ALT + Q");

    /* Boton TipoFacil */
    facil =
        new JButton(new ImageIcon(i2.getImage().getScaledInstance(170, 40, Image.SCALE_SMOOTH)));
    facil.setBounds(97, 262, 170, 40);
    facil.setRolloverIcon(
        new ImageIcon(i22.getImage().getScaledInstance(170, 40, Image.SCALE_SMOOTH)));
    facil.setBorderPainted(false);
    facil.addActionListener(this);
    facil.setMnemonic(KeyEvent.VK_F);
    facil.setToolTipText("jugar en modo principiante ALT + F");

    /* Boton TipoDificil */
    dific =
        new JButton(new ImageIcon(i3.getImage().getScaledInstance(170, 40, Image.SCALE_SMOOTH)));
    dific.setBounds(97, 317, 170, 40);
    dific.setRolloverIcon(
        new ImageIcon(i33.getImage().getScaledInstance(170, 40, Image.SCALE_SMOOTH)));
    dific.setBorderPainted(false);
    dific.addActionListener(this);
    dific.setMnemonic(KeyEvent.VK_D);
    dific.setToolTipText("jugar en modo dificil ALT + D");

    /* Boton Salir */
    salir =
        new JButton(new ImageIcon(i4.getImage().getScaledInstance(170, 40, Image.SCALE_SMOOTH)));
    salir.setBounds(97, 430, 170, 40);
    salir.setRolloverIcon(
        new ImageIcon(i44.getImage().getScaledInstance(170, 40, Image.SCALE_SMOOTH)));
    salir.setBorderPainted(false);
    salir.addActionListener(this);
    salir.setMnemonic(KeyEvent.VK_S);
    salir.setToolTipText("Salir ALT + S");

    /* Boton Red */
    red = new JButton(new ImageIcon(i6.getImage().getScaledInstance(170, 40, Image.SCALE_SMOOTH)));
    red.setBounds(97, 374, 170, 40);
    red.setRolloverIcon(
        new ImageIcon(i66.getImage().getScaledInstance(170, 40, Image.SCALE_SMOOTH)));
    red.setBorderPainted(false);
    red.addActionListener(this);
    red.setMnemonic(KeyEvent.VK_C);
    red.setToolTipText("Jugar con varios jugadores ALT + C");

    c = getContentPane();
    c.setLayout(null);

    c.add(titulo);
    c.add(estad);
    c.add(facil);
    c.add(registrar);
    c.add(dific);
    c.add(salir);
    c.add(red);
    c.add(fondo);
  }
Esempio n. 20
0
  /** Install the Rotate-Button into the toolbar */
  private void installRotateButton() {
    URL imgURL = ClassLoader.getSystemResource("ch/tbe/pics/rotate.gif");
    ImageIcon rotateIcon = new ImageIcon(imgURL);
    rotate = new JButton(rotateIcon);
    rotate.setEnabled(false);
    rotatePanel = new JToolBar();
    rotatePanel.setOrientation(1);
    rotatePanel.setLayout(new BorderLayout(0, 1));
    rotateSlider = new JSlider();
    rotateSlider.setMaximum(359);
    rotateSlider.setMinimum(0);
    rotateSlider.setMaximumSize(new Dimension(100, 100));
    rotateSlider.setOrientation(1);
    Box box = Box.createVerticalBox();

    sliderValue.setPreferredSize(new Dimension(30, 20));

    rotateSlider.setAlignmentY(Component.TOP_ALIGNMENT);
    box.add(sliderValue);
    box.add(rotateSlider);
    sliderValue.setAlignmentY(Component.TOP_ALIGNMENT);
    rotatePanel.add(box, BorderLayout.NORTH);

    sliderValue.addFocusListener(
        new FocusListener() {

          private int oldValue = 0;

          public void focusGained(FocusEvent arg0) {
            oldValue = Integer.parseInt(sliderValue.getText());
          }

          public void focusLost(FocusEvent arg0) {
            int newValue = 0;
            try {
              newValue = Integer.parseInt(sliderValue.getText());
            } catch (Exception ex) {
              sliderValue.setText(Integer.toString(oldValue));
            }
            if (newValue >= 0 && newValue <= 359) {

              RotateCommand rc = new RotateCommand(board.getSelectedItems());
              ArrayList<Command> actCommands = new ArrayList<Command>();
              actCommands.add(rc);
              TBE.getInstance().addCommands(actCommands);
              rotateSlider.setValue(newValue);
            } else {
              sliderValue.setText(Integer.toString(oldValue));
            }
          }
        });

    rotateSlider.addChangeListener(
        new ChangeListener() {

          public void stateChanged(ChangeEvent arg0) {

            if (board.getSelectionCount() == 1
                && board.getSelectionCells()[0] instanceof ShapeItem) {
              sliderValue.setText(Integer.toString(rotateSlider.getValue()));
              ShapeItem s = (ShapeItem) board.getSelectionCells()[0];
              board.removeItem(new ItemComponent[] {s});
              s.setRotation(rotateSlider.getValue());
              board.addItem(s);
            }
          }
        });
    rotateSlider.addMouseListener(
        new MouseAdapter() {

          private int value;

          public void mousePressed(MouseEvent e) {
            value = rotateSlider.getValue();
          }

          public void mouseReleased(MouseEvent e) {
            if (value != rotateSlider.getValue()) {
              RotateCommand rc = new RotateCommand(board.getSelectedItems());
              ArrayList<Command> actCommands = new ArrayList<Command>();
              actCommands.add(rc);
              TBE.getInstance().addCommands(actCommands);
              rc.setRotation(value);
            }
          }
        });

    rotate.setToolTipText(workingViewLabels.getString("rotate"));

    rotate.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (board.getSelectionCount() == 1
                && board.getSelectedItems()[0] instanceof ShapeItem) {
              rotateSlider.setValue(((ShapeItem) board.getSelectedItems()[0]).getRotation());
            }
            rotatePanel.setVisible(!rotatePanel.isVisible());
            showRotate = !showRotate;
          }
        });

    rotate.setContentAreaFilled(false);
    rotate.setBorderPainted(false);
    toolbar.add(rotate);
    rotatePanel.setVisible(false);
    this.add(rotatePanel, BorderLayout.EAST);
  }
Esempio n. 21
0
  public p2() throws Exception {

    // setBorder(BorderFactory.createEtchedBorder(Color.lightGray, Color.DARK_GRAY));
    p = new JPanel();
    // setBackground(Color.white);
    p.setLayout(new GridLayout(11, 3));
    p.setBounds(0, 20, 309, 130);

    un = new JLabel("*  Username");
    ps1 = new JLabel("*  Password");
    ps2 = new JLabel("*  Confirm Password");
    fn = new JLabel("*  First Name");
    ln = new JLabel("   Last Name");
    eid = new JLabel("*  Email ID");
    mb = new JLabel("*  Mobile");
    cct = new JLabel("*  Current City");
    hquali = new JLabel("*  Highest Qualification");
    dob = new JLabel("   DOB");
    dober = new JLabel();
    dd = new JLabel("DD");
    mm = new JLabel("MM");
    yy = new JLabel("YY");
    member = new Label("     already a member?");
    member.addMouseListener(this);

    er1 = new Label("");
    er2 = new Label("");
    er3 = new Label("");
    er4 = new Label("");
    er5 = new Label("");
    er6 = new Label("");
    er7 = new Label("");
    er8 = new Label("");
    er9 = new Label("");
    er10 = new Label("");

    un1 = new JTextField(15);
    ps11 = new JPasswordField(15);
    ps21 = new JPasswordField(15);
    fn1 = new JTextField(15);
    ln1 = new JTextField(15);
    eid1 = new JTextField(15);
    mb1 = new JTextField(15);
    cct1 = new JTextField(15);
    hquali1 = new JTextField(15);
    dober1 = new JTextField(2);
    dober2 = new JTextField(2);
    dober3 = new JTextField(2);

    sub = new JButton("Sign up");
    sub.setBorderPainted(false);
    sub.setFocusable(true);
    sub.addActionListener(this);

    dober.setLayout(new FlowLayout());
    dober.add(dober1);
    dober.add(dd);
    dober.add(dober2);
    dober.add(mm);
    dober.add(dober3);
    dober.add(yy);

    p.add(fn);
    p.add(fn1);
    p.add(er1);
    p.add(ln);
    p.add(ln1);
    p.add(er2);
    p.add(un);
    p.add(un1);
    p.add(er3);
    p.add(ps1);
    p.add(ps11);
    p.add(er4);
    p.add(ps2);
    p.add(ps21);
    p.add(er5);
    p.add(eid);
    p.add(eid1);
    p.add(er6);
    p.add(mb);
    p.add(mb1);
    p.add(er7);
    p.add(cct);
    p.add(cct1);
    p.add(er8);
    p.add(hquali);
    p.add(hquali1);
    p.add(er9);
    p.add(dob);
    p.add(dober);
    p.add(er10);

    p.add(sub);
    p.add(member);
    add(p);
  }
Esempio n. 22
0
  public void initialize(final Controller controller) {
    super.initialize(controller);

    WWMenu fileMenu = (WWMenu) this.getController().getRegisteredObject(Constants.FILE_MENU);
    if (fileMenu != null) fileMenu.addMenu(this.getFeatureID());

    this.tabbedPane = new JTabbedPane();
    this.tabbedPane.setOpaque(false);

    this.tabbedPane.add(new JPanel());
    this.tabbedPane.setTitleAt(0, "+"); // this tab is just a button for adding servers/panels
    this.tabbedPane.setToolTipTextAt(0, "Connect to WMS Server");

    this.tabbedPane.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent changeEvent) {
            if (tabbedPane.getSelectedIndex() == 0) {
              addNewPanel(tabbedPane); // Add new panel when '+' is selected
            }
          }
        });

    // Add an initial panel to the tabbed pane
    this.addNewPanel(this.tabbedPane);
    tabbedPane.setSelectedIndex(1);

    this.setTaskComponent(this.tabbedPane);
    this.setLocation(SwingConstants.CENTER, SwingConstants.CENTER);
    this.getJDialog().setResizable(true);

    JButton deleteButton =
        new JButton(ImageLibrary.getIcon("gov/nasa/worldwindow/images/delete-20x20.png"));
    deleteButton.setToolTipText("Remove Server");
    deleteButton.setOpaque(false);
    deleteButton.setBackground(new Color(0, 0, 0, 0));
    deleteButton.setBorderPainted(false);
    deleteButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            deleteCurrentPanel();
          }
        });
    deleteButton.setEnabled(true);
    this.insertLeftDialogComponent(deleteButton);
    //
    //        JButton cancelButton = new JButton("Cancel");
    //        cancelButton.setToolTipText("Cancel capabilities retrieval from server");
    //        cancelButton.setOpaque(false);
    //        cancelButton.addActionListener(new ActionListener()
    //        {
    //            public void actionPerformed(ActionEvent actionEvent)
    //            {
    //                cancelCurrentRetrieval();
    //            }
    //        });
    //        this.insertRightDialogComponent(cancelButton);

    this.setTitle("WMS Servers");
    this.dialog.validate();
    this.dialog.pack();
  }
Esempio n. 23
0
 public LogDateChooser(String label) {
   thisDialog = this;
   border = new EtchedBorder();
   setBorder(border);
   Font f = new Font("Helvetica", Font.PLAIN, 10);
   title = new JLabel(label);
   add(title);
   setLayout(new DateLayout());
   dfs = new DateFormatSymbols();
   months = dfs.getMonths();
   weekdays = dfs.getShortWeekdays();
   for (int i = 0; i < 7; i++) {
     days[i] = new JLabel(weekdays[i + 1]);
     days[i].setFont(f);
     add(days[i]);
   }
   gc = new GregorianCalendar();
   mDown = new JButton("<");
   mDown.setMargin(new Insets(0, 0, 0, 0));
   mDown.addActionListener(new MDownEar());
   mDown.setBorderPainted(false);
   mDown.setFont(f);
   mDown.setForeground(Color.BLUE);
   add(mDown);
   mUp = new JButton(">");
   mUp.setMargin(new Insets(0, 0, 0, 0));
   mUp.addActionListener(new MUpEar());
   mUp.setBorderPainted(false);
   mUp.setFont(f);
   mUp.setForeground(Color.BLUE);
   add(mUp);
   month = new JLabel(months[gc.get(Calendar.MONTH)]);
   month.setHorizontalAlignment(SwingConstants.CENTER);
   month.setFont(f);
   add(month);
   year = new JLabel(new Integer(gc.get(Calendar.YEAR)).toString());
   year.setFont(f);
   add(year);
   yDown = new JButton("<");
   yDown.setMargin(new Insets(0, 0, 0, 0));
   yDown.addActionListener(new YDownEar());
   yDown.setBorderPainted(false);
   yDown.setFont(f);
   yDown.setForeground(Color.BLUE);
   add(yDown);
   yUp = new JButton(">");
   yUp.setMargin(new Insets(0, 0, 0, 0));
   yUp.addActionListener(new YUpEar());
   yUp.setBorderPainted(false);
   yUp.setFont(f);
   yUp.setForeground(Color.BLUE);
   add(yUp);
   //    System.out.println(year.getText());
   NumberEar numberEar = new NumberEar();
   for (int i = 0; i < 31; i++) {
     number[i] = new JButton(new Integer(i + 1).toString());
     number[i].setMargin(new Insets(0, 0, 0, 0));
     number[i].addActionListener(numberEar);
     number[i].setBorderPainted(false);
     number[i].setContentAreaFilled(false);
     number[i].setFont(f);
     number[i].setForeground(Color.BLUE);
     add(number[i]);
   }
   number[0].setForeground(Color.CYAN);
 }