public ButtonEditor(JCheckBox checkBox, Main main) {

    super(checkBox);
    button = new JButton();
    button.setOpaque(true);
    this.main = main;
  }
예제 #2
0
  /** Method to create link annotation GUI. */
  private void createGUI() {

    // Create and setup an Appearance panel
    setBorder(
        new TitledBorder(
            new EtchedBorder(EtchedBorder.LOWERED),
            messageBundle.getString("viewer.utilityPane.annotation.ink.appearance.title"),
            TitledBorder.LEFT,
            TitledBorder.DEFAULT_POSITION));
    // Line thickness
    lineThicknessBox = new JComboBox(LINE_THICKNESS_LIST);
    lineThicknessBox.setSelectedIndex(DEFAULT_LINE_THICKNESS);
    lineThicknessBox.addItemListener(this);
    add(new JLabel(messageBundle.getString("viewer.utilityPane.annotation.ink.lineThickness")));
    add(lineThicknessBox);
    // Line style
    lineStyleBox = new JComboBox(LINE_STYLE_LIST);
    lineStyleBox.setSelectedIndex(DEFAULT_LINE_STYLE);
    lineStyleBox.addItemListener(this);
    add(new JLabel(messageBundle.getString("viewer.utilityPane.annotation.ink.lineStyle")));
    add(lineStyleBox);
    // border colour
    colorBorderButton = new JButton();
    colorBorderButton.addActionListener(this);
    colorBorderButton.setOpaque(true);
    colorBorderButton.setBackground(DEFAULT_BORDER_COLOR);
    add(new JLabel(messageBundle.getString("viewer.utilityPane.annotation.ink.colorBorderLabel")));
    add(colorBorderButton);
  }
 /**
  * Creates a JButton with an X
  *
  * @return the button
  */
 private JButton createXButton() {
   JButton closeButton = new JButton("X");
   closeButton.setOpaque(false);
   closeButton.setMargin(null);
   closeButton.setFont(closeButton.getFont().deriveFont(Font.BOLD).deriveFont((float) 10));
   closeButton.setBorder(new EmptyBorder(1, 1, 1, 1));
   return closeButton;
 }
  /*
   * We do custom rendering of the arrow button because there are too many
   * hacks in each theme's combobox UI.
   * We also cannot forward paint of the arrow button to a stock combobox
   * because each LAF and theme may render different parts of the
   * arrow button with different sizes.  For example, in Mac, the arrow button is
   * drawn with a border (the responsibility of the border
   * near the arrow button belongs to the button).  However in IntelliJ and Darcula,
   * the arrow button is drawn without a border and it's the responsibility of the
   * outer control to draw a border.  In addition, darcula renders part of the arrow
   * button outside the button.  That is, the arrow button looks like it's about 20x20,
   * but actually, it's only 16x16, with part of the rendering done via paint on the combobox itself.
   * So while this creates some small inconsistencies,
   * it reduces the chance of a major UI issue such as a completely poorly drawn button with a double border.
   */
  private JButton createArrowButton() {
    final Color bg = getBackground();
    final Color fg = getForeground();
    JButton button =
        new BasicArrowButton(SwingConstants.SOUTH, bg, fg, fg, fg) {

          @Override
          public void paint(Graphics g2) {
            final Graphics2D g = (Graphics2D) g2;
            final GraphicsConfig config = new GraphicsConfig(g);

            final int w = getWidth();
            final int h = getHeight();
            g.setColor(getButtonBackgroundColor());
            g.fillRect(0, 0, w, h);
            g.setColor(getArrowColor());
            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g.setRenderingHint(
                RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
            g.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
            final int midx = (int) Math.ceil((w - 1) / 2.0) + 1;
            final int midy = (int) Math.ceil(h / 2.0);
            final Path2D.Double path = new Path2D.Double();
            path.moveTo(midx - 4, midy - 2);
            path.lineTo(midx + 4, midy - 2);
            path.lineTo(midx, midy + 4);
            path.lineTo(midx - 4, midy - 2);
            path.closePath();
            g.fill(path);
            g.setColor(getBorderColor());
            if (UIUtil.isUnderGTKLookAndFeel()) {
              g.drawLine(0, 1, 0, h - 2);
              g.drawLine(0, 1, w - 2, 1);
              g.drawLine(0, h - 2, w - 2, h - 2);
              g.drawLine(w - 2, 1, w - 2, h - 2);
            } else {
              g.drawLine(0, 0, 0, h);
            }
            config.restore();
          }

          @Override
          public Dimension getPreferredSize() {
            int newSize =
                CustomizableComboBox.this.getHeight()
                    - (CustomizableComboBox.this.getInsets().bottom
                        + CustomizableComboBox.this.getInsets().top);
            return new Dimension(newSize, newSize);
          }
        };
    button.setOpaque(false);
    button.setFocusable(false);
    button.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 1));

    return button;
  }
  /**
   * Creates the view class
   *
   * @param controller The controller of the view class
   */
  public SelectMazeView(SelectMazeController controller) {

    this.controller = controller;
    this.mazelist = this.controller.getMazelist();
    this.setPreferredSize(new Dimension(500, 500));
    this.setLayout(new BorderLayout());

    this.setBackground(Color.WHITE);
    this.setOpaque(true);
    this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    this.selectMazeLabel = new JLabel("Select a maze");
    this.selectMazeLabel.setFont(new Font("Sans Serif", Font.PLAIN, 20));
    this.selectMazeLabel.setForeground(Color.BLACK);
    this.selectMazeLabel.setOpaque(false);
    this.selectMazeLabel.setPreferredSize(new Dimension(500, 70));
    this.selectMazeLabel.setHorizontalAlignment(JLabel.CENTER);

    this.listpanel = new JPanel();
    this.listpanel.setOpaque(false);
    this.listpanel.setLayout(new FlowLayout());

    this.add(this.selectMazeLabel, BorderLayout.NORTH);
    this.add(this.listpanel, BorderLayout.CENTER);

    int i = 0;
    while (i < this.mazelist.size()) {
      String mazename = this.mazelist.get(i);
      JButton mazeButton = new JButton(mazename);

      mazeButton.addMouseListener(this.mazeButtonListener);

      mazeButton.setFont(new Font("Sans Serif", Font.PLAIN, 16));
      mazeButton.setForeground(Color.DARK_GRAY);
      mazeButton.setOpaque(false);
      mazeButton.setContentAreaFilled(false);
      mazeButton.setBorderPainted(false);

      mazeButton.setOpaque(true);
      this.listpanel.add(mazeButton);
      i++;
    }
  }
예제 #6
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);
  }
 public ButtonEditorSupprimer(JCheckBox checkBox) {
   super(checkBox);
   button = new JButton();
   button.setOpaque(true);
   button.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           fireEditingStopped();
         }
       });
 }
예제 #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);
    }
예제 #9
0
 public Buttons() {
   setPreferredSize(new Dimension(w, h));
   setBackground(new Color(0, 0, 0, 0));
   setLayout(new BorderLayout());
   min = new JButton("-");
   plus = new JButton("+");
   // min.setPreferredSize(new Dimension(100,10));
   // plus.setPreferredSize(new Dimension(100,10));
   min.setBackground(Color.WHITE);
   plus.setBackground(Color.WHITE);
   min.setOpaque(false);
   plus.setOpaque(false);
   min.setBorderPainted(true);
   min.setFocusPainted(true);
   plus.setFocusPainted(true);
   plus.setBorderPainted(true);
   min.addActionListener(this);
   plus.addActionListener(this);
   min.setActionCommand("-");
   plus.setActionCommand("+");
   add(plus, BorderLayout.NORTH);
   add(min, BorderLayout.CENTER);
 }
예제 #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);
 }
  private static JButton createButton(String accessibleName, Icon icon, Action action) {
    JButton button =
        new JButton() {
          boolean mouseOverButton = false;

          {
            enableEvents(AWTEvent.MOUSE_EVENT_MASK);
            addMouseListener(
                new MouseAdapter() {
                  @Override
                  public void mouseEntered(MouseEvent e) {
                    mouseOverButton = true;
                    repaint();
                  }

                  @Override
                  public void mouseExited(MouseEvent e) {
                    mouseOverButton = false;
                    repaint();
                  }
                });
          }

          @Override
          protected void paintComponent(Graphics g) {
            final Window window = SwingUtilities.windowForComponent(this);
            float alpha = window.isActive() && mouseOverButton ? 1f : 0.5f;
            final GraphicsConfig config = GraphicsUtil.paintWithAlpha(g, alpha);
            getIcon().paintIcon(this, g, 0, 0);
            config.restore();
          }
        };
    button.setFocusPainted(false);
    button.setFocusable(false);
    button.setOpaque(false);
    button.putClientProperty("paintActive", Boolean.TRUE);
    button.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, accessibleName);
    button.setBorder(JBUI.Borders.empty());
    button.setText(null);
    button.setAction(action);
    button.setIcon(icon);
    return button;
  }
예제 #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);
  }
예제 #13
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);
  }
예제 #14
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);
  }
예제 #15
0
  private <T extends Enum<T>> void createControls(JPanel panel, ZrtpConfigureTableModel<T> model) {
    ResourceManagementService resources = NeomediaActivator.getResources();

    final JButton upButton = new JButton(resources.getI18NString("impl.media.configform.UP"));
    upButton.setOpaque(false);

    final JButton downButton = new JButton(resources.getI18NString("impl.media.configform.DOWN"));
    downButton.setOpaque(false);

    Container buttonBar = new TransparentPanel(new GridLayout(0, 1));
    buttonBar.add(upButton);
    buttonBar.add(downButton);

    panel.setBorder(BorderFactory.createEmptyBorder(MARGIN, MARGIN, MARGIN, MARGIN));
    panel.setLayout(new GridBagLayout());

    final JTable table = new JTable(model.getRowCount(), 2);
    table.setShowGrid(false);
    table.setTableHeader(null);
    table.setModel(model);
    // table.setFillsViewportHeight(true); // Since 1.6 only - nicer view

    /*
     * The first column contains the check boxes which enable/disable their
     * associated encodings and it doesn't make sense to make it wider than
     * the check boxes.
     */
    TableColumnModel tableColumnModel = table.getColumnModel();
    TableColumn tableColumn = tableColumnModel.getColumn(0);
    tableColumn.setMaxWidth(tableColumn.getMinWidth() + 5);
    table.doLayout();

    GridBagConstraints constraints = new GridBagConstraints();
    constraints.anchor = GridBagConstraints.CENTER;
    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridwidth = 1;
    constraints.gridx = 0;
    constraints.gridy = 1;
    constraints.weightx = 1;
    constraints.weighty = 1;
    panel.add(new JScrollPane(table), constraints);

    constraints.anchor = GridBagConstraints.NORTHEAST;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridwidth = 1;
    constraints.gridx = 1;
    constraints.gridy = 1;
    constraints.weightx = 0;
    constraints.weighty = 0;
    panel.add(buttonBar, constraints);

    ListSelectionListener tableSelectionListener =
        new ListSelectionListener() {
          @SuppressWarnings("unchecked")
          public void valueChanged(ListSelectionEvent event) {
            if (table.getSelectedRowCount() == 1) {
              int selectedRow = table.getSelectedRow();
              if (selectedRow > -1) {
                ZrtpConfigureTableModel<T> model = (ZrtpConfigureTableModel<T>) table.getModel();
                upButton.setEnabled(selectedRow > 0 && model.checkEnableUp(selectedRow));
                downButton.setEnabled(
                    selectedRow < (table.getRowCount() - 1) && model.checkEnableDown(selectedRow));
                return;
              }
            }
            upButton.setEnabled(false);
            downButton.setEnabled(false);
          }
        };
    table.getSelectionModel().addListSelectionListener(tableSelectionListener);

    TableModelListener tableListener =
        new TableModelListener() {
          @SuppressWarnings("unchecked")
          public void tableChanged(TableModelEvent e) {
            if (table.getSelectedRowCount() == 1) {
              int selectedRow = table.getSelectedRow();
              if (selectedRow > -1) {
                ZrtpConfigureTableModel<T> model = (ZrtpConfigureTableModel<T>) table.getModel();
                upButton.setEnabled(selectedRow > 0 && model.checkEnableUp(selectedRow));
                downButton.setEnabled(
                    selectedRow < (table.getRowCount() - 1) && model.checkEnableDown(selectedRow));
                return;
              }
            }
            upButton.setEnabled(false);
            downButton.setEnabled(false);
          }
        };
    table.getModel().addTableModelListener(tableListener);

    tableSelectionListener.valueChanged(null);

    ActionListener buttonListener =
        new ActionListener() {
          @SuppressWarnings("unchecked")
          public void actionPerformed(ActionEvent event) {
            Object source = event.getSource();
            boolean up;
            if (source == upButton) up = true;
            else if (source == downButton) up = false;
            else return;

            int index =
                ((ZrtpConfigureTableModel<T>) table.getModel())
                    .move(table.getSelectedRow(), up, up);
            table.getSelectionModel().setSelectionInterval(index, index);
          }
        };
    upButton.addActionListener(buttonListener);
    downButton.addActionListener(buttonListener);
  }
예제 #16
0
  /** Creates an instance of <tt>ZrtpConfigurePanel</tt>. */
  public ZrtpConfigurePanel() {
    super(new BorderLayout());

    ResourceManagementService resources = NeomediaActivator.getResources();

    JPanel mainPanel = new TransparentPanel(new BorderLayout(0, 10));

    final JButton stdButton =
        new JButton(resources.getI18NString("impl.media.security.zrtp.STANDARD"));
    stdButton.setOpaque(false);

    final JButton mandButton =
        new JButton(resources.getI18NString("impl.media.security.zrtp.MANDATORY"));
    mandButton.setOpaque(false);

    final JButton saveButton = new JButton(resources.getI18NString("service.gui.SAVE"));
    saveButton.setOpaque(false);

    JPanel buttonBar = new TransparentPanel(new GridLayout(1, 7));
    buttonBar.add(stdButton);
    buttonBar.add(mandButton);
    buttonBar.add(Box.createHorizontalStrut(10));
    buttonBar.add(saveButton);

    ConfigurationService cfg = NeomediaActivator.getConfigurationService();
    boolean trusted = cfg.getBoolean(TRUSTED_PROP, false);
    boolean sasSign = cfg.getBoolean(SASSIGN_PROP, false);

    JPanel checkBar = new TransparentPanel(new GridLayout(1, 2));
    final JCheckBox trustedMitM =
        new SIPCommCheckBox(resources.getI18NString("impl.media.security.zrtp.TRUSTED"), trusted);
    final JCheckBox sasSignature =
        new SIPCommCheckBox(
            resources.getI18NString("impl.media.security.zrtp.SASSIGNATURE"), sasSign);
    checkBar.add(trustedMitM);
    checkBar.add(sasSignature);
    mainPanel.add(checkBar, BorderLayout.NORTH);

    ActionListener buttonListener =
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            Object source = event.getSource();
            if (source == stdButton) {
              inActive.clear();
              active.setStandardConfig();
              pkc.setStandard();
              hc.setStandard();
              sc.setStandard();
              cc.setStandard();
              lc.setStandard();
            } else if (source == mandButton) {
              inActive.clear();
              active.setMandatoryOnly();
              pkc.setStandard();
              hc.setStandard();
              sc.setStandard();
              cc.setStandard();
              lc.setStandard();
            } else if (source == saveButton) {
              ConfigurationService cfg = NeomediaActivator.getConfigurationService();

              cfg.setProperty(TRUSTED_PROP, String.valueOf(active.isTrustedMitM()));
              cfg.setProperty(SASSIGN_PROP, String.valueOf(active.isSasSignature()));
              pkc.saveConfig();
              hc.saveConfig();
              sc.saveConfig();
              cc.saveConfig();
              lc.saveConfig();
            } else return;
          }
        };
    stdButton.addActionListener(buttonListener);
    mandButton.addActionListener(buttonListener);
    saveButton.addActionListener(buttonListener);

    ItemListener itemListener =
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            Object source = e.getItemSelectable();

            if (source == trustedMitM) {
              active.setTrustedMitM(trustedMitM.isSelected());
            } else if (source == sasSignature) {
              active.setSasSignature(sasSignature.isSelected());
            }
          }
        };
    trustedMitM.addItemListener(itemListener);
    sasSignature.addItemListener(itemListener);

    JTabbedPane algorithmsPane = new SIPCommTabbedPane();

    algorithmsPane.addTab(resources.getI18NString("impl.media.security.zrtp.PUB_KEYS"), pkc);
    algorithmsPane.addTab(resources.getI18NString("impl.media.security.zrtp.HASHES"), hc);
    algorithmsPane.addTab(resources.getI18NString("impl.media.security.zrtp.SYM_CIPHERS"), cc);
    algorithmsPane.addTab(resources.getI18NString("impl.media.security.zrtp.SAS_TYPES"), sc);
    algorithmsPane.addTab(resources.getI18NString("impl.media.security.zrtp.SRTP_LENGTHS"), lc);

    algorithmsPane.setMinimumSize(new Dimension(400, 100));
    algorithmsPane.setPreferredSize(new Dimension(400, 200));
    mainPanel.add(algorithmsPane, BorderLayout.CENTER);

    mainPanel.add(buttonBar, BorderLayout.SOUTH);

    add(mainPanel);
  }
예제 #17
0
  public MainForm() {
    GUIStandartOperations.FrameStartOperations(this);
    setSize(960, 610);
    setLocationRelativeTo(null);
    setLayout(null);

    addMouseListener(
        new MouseAdapter() {
          public void mouseReleased(MouseEvent e) {
            mouseDownCompCoords = null;
          }

          public void mousePressed(MouseEvent e) {
            mouseDownCompCoords = e.getPoint();
          }
        });

    addMouseMotionListener(
        new MouseAdapter() {
          public void mouseDragged(MouseEvent e) {
            Point currCoords = e.getLocationOnScreen();
            setLocation(currCoords.x - mouseDownCompCoords.x, currCoords.y - mouseDownCompCoords.y);
          }
        });

    dialogPanelArrayList = new ArrayList<>();
    dialogTabArrayList = new ArrayList<>();

    bigPanel = new JPanel(null);
    bigPanel.setSize(1300, 600);
    bigPanel.setOpaque(false);
    bigPanel.setBackground(new Color(0, 0, 0, 0));

    dialogTabsPanel = new JPanel(null);
    dialogTabsPanel.setBackground(new Color(0, 0, 0, 150));

    JPanel topPanel = new JPanel(null);
    topPanel.setBackground(new Color(0, 0, 0, 150));
    topPanel.setBounds(30, 20, 900, 65);
    topPanel.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 0, Color.WHITE));
    bigPanel.add(topPanel);

    notificationPanel = new NotificationPanel();
    notificationPanel.setBounds(5, 0, 500, 65);
    notificationPanel.setBorder(null);
    topPanel.add(notificationPanel);

    RepaintPanel repaintPanel = new RepaintPanel(notificationPanel);
    Thread thread = new Thread(repaintPanel);
    thread.start();

    RepaintPanel repaintPanel2 = new RepaintPanel(bigPanel);
    Thread thread2 = new Thread(repaintPanel2);
    thread2.start();

    changeAccButton =
        GUIStandartOperations.ButtonStartOperations(
            changeAccButIcon, changeAccButIconEntered, true);
    settingsButton =
        GUIStandartOperations.ButtonStartOperations(settingsButIcon, settingsButIconEntered, true);
    contactsButton =
        GUIStandartOperations.ButtonStartOperations(contactsButIcon, contactsButIconEntered, true);
    exitButton = GUIStandartOperations.ButtonStartOperations(exitButIcon, exitButIconEntered, true);
    plusButton = GUIStandartOperations.ButtonStartOperations(plusButIcon, plusButIconEntered, true);
    homeButton =
        GUIStandartOperations.ButtonStartOperations(dialogButIcon, dialogButIconEntered, true);

    changeAccButton.setToolTipText("Change account");
    settingsButton.setToolTipText("Your personal settings");
    contactsButton.setToolTipText("Contacts");
    exitButton.setToolTipText("Exit ChatApp");
    homeButton.setToolTipText("Dialog page / Home");

    friendPanelButton = new JButton();
    friendPanelButton.setOpaque(false);
    friendPanelButton.setBorder(null);
    friendPanelButton.setFocusPainted(false);
    friendPanelButton.setContentAreaFilled(false);
    friendPanelButton.setIcon(friendSideOpenIcon);
    friendPanelButton.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseEntered(MouseEvent e) {
            friendPanelButton.setIcon(friendSideOpenIconEntered);
          }

          @Override
          public void mouseExited(MouseEvent e) {
            friendPanelButton.setIcon(friendSideOpenIcon);
          }
        });

    friendPanelButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            isFriendPanelOpened = !isFriendPanelOpened;
            friendPanelMode();
          }
        });

    friendSidePanel = new FriendSidePanel();
    friendSidePanel.setBorder(null);
    friendSidePanel.setBounds(970, 50, 450, 650);
    bigPanel.add(friendSidePanel);

    noConversationsPanel = new JPanel(null);
    noConversationsPanel.setOpaque(false);
    noConversationsPanel.setBackground(new Color(0, 0, 0, 0));
    noConversationsPanel.setBounds(0, 0, 960, 600);
    JLabel noConversationLabel = new JLabel("You have no active conversations now...");
    noConversationLabel.setFont(Fonts.nickFont);
    noConversationLabel.setHorizontalAlignment(SwingConstants.CENTER);
    noConversationLabel.setForeground(Color.WHITE);
    noConversationLabel.setBackground(new Color(0, 0, 0, 0));
    noConversationLabel.setBounds(0, 300, 960, 50);

    JButton noConversationsButton = GUIStandartOperations.ButtonStartOperations(null, null, false);
    noConversationsButton.setText("<HTML><U>It's time to begin, isn't it?</U></HTML>");
    noConversationsButton.setFont(Fonts.nickFont);
    noConversationsButton.setBounds(0, 350, 960, 50);
    noConversationsButton.setHorizontalAlignment(SwingConstants.CENTER);
    noConversationsButton.setForeground(Color.RED);
    noConversationsButton.addActionListener(
        new AbstractAction() {
          @Override
          public void actionPerformed(ActionEvent e) {
            isFriendPanelOpened = true;
            friendPanelMode();
          }
        });

    noConversationsPanel.add(noConversationsButton);
    noConversationsPanel.add(noConversationLabel);
    noConversationsPanel.setVisible(false);

    final int shiftRight = 90;

    changeAccButton.setBounds(420 + shiftRight, 6, 64, 64);
    topPanel.add(changeAccButton);
    homeButton.setBounds(550 + shiftRight, 6, 64, 64);
    topPanel.add(homeButton);
    settingsButton.setBounds(650 + shiftRight, 0, 64, 64);
    topPanel.add(settingsButton);
    contactsButton.setBounds(600 + shiftRight, 0, 64, 64);
    topPanel.add(contactsButton);
    exitButton.setBounds(470 + shiftRight, 0, 64, 64);
    topPanel.add(exitButton);
    friendPanelButton.setBounds(730 + shiftRight, 6, 64, 64);
    topPanel.add(friendPanelButton);

    friendPanelButton.setVisible(false);

    homePanel = new HomePanel();
    homePanel.setBounds(0, 84, 960, 1000);

    dialogTabsPanel.setBounds(30, 100, 900, 40);
    dialogTabsPanel.setVisible(false);

    bigPanel.add(dialogTabsPanel);
    bigPanel.add(homePanel);
    bigPanel.add(noConversationsPanel);

    this.add(bigPanel);

    exitButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            System.exit(0);
          }
        });
  }
예제 #18
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();
  }
예제 #19
0
  @SuppressWarnings("serial")
  public JTableRenderer(final Object cell, final GraphComponent graphContainer) {
    this.cell = cell;
    this.graphContainer = graphContainer;
    this.graph = graphContainer.getGraph();
    setLayout(new BorderLayout());
    setBorder(
        BorderFactory.createCompoundBorder(
            ShadowBorder.getSharedInstance(), BorderFactory.createBevelBorder(BevelBorder.RAISED)));

    JPanel title = new JPanel();
    title.setBackground(new Color(149, 173, 239));
    title.setOpaque(true);
    title.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1));
    title.setLayout(new BorderLayout());

    JLabel icon =
        new JLabel(new ImageIcon(JTableRenderer.class.getResource(IMAGE_PATH + "preferences.gif")));
    icon.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 1));
    title.add(icon, BorderLayout.WEST);

    JLabel label = new JLabel(String.valueOf(graph.getLabel(cell)));
    label.setForeground(Color.WHITE);
    label.setFont(title.getFont().deriveFont(Font.BOLD, 11));
    label.setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 2));
    title.add(label, BorderLayout.CENTER);

    JPanel toolBar2 = new JPanel();
    toolBar2.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 2));
    toolBar2.setOpaque(false);
    JButton button =
        new JButton(
            new AbstractAction(
                "", new ImageIcon(JTableRenderer.class.getResource(IMAGE_PATH + "minimize.gif"))) {

              public void actionPerformed(ActionEvent e) {
                graph.foldCells(graph.isCellCollapsed(cell), false, new Object[] {cell});
                ((JButton) e.getSource())
                    .setIcon(
                        new ImageIcon(
                            JTableRenderer.class.getResource(
                                IMAGE_PATH
                                    + ((graph.isCellCollapsed(cell))
                                        ? "maximize.gif"
                                        : "minimize.gif"))));
              }
            });
    button.setPreferredSize(new Dimension(16, 16));
    button.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    button.setToolTipText("Collapse/Expand");
    button.setOpaque(false);
    toolBar2.add(button);

    title.add(toolBar2, BorderLayout.EAST);
    add(title, BorderLayout.NORTH);

    // CellStyle style =
    // graph.getStylesheet().getCellStyle(graph.getModel(),
    // cell);
    // if (style.getStyleClass() == null) {
    table = new MyTable();
    JScrollPane scrollPane = new JScrollPane(table);
    scrollPane.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));

    if (graph.getModel().getChildCount(cell) == 0) {
      scrollPane.getViewport().setBackground(Color.WHITE);
      setOpaque(true);
      add(scrollPane, BorderLayout.CENTER);
    }

    scrollPane
        .getVerticalScrollBar()
        .addAdjustmentListener(
            new AdjustmentListener() {

              public void adjustmentValueChanged(AdjustmentEvent e) {
                graphContainer.refresh();
              }
            });

    label = new JLabel(new ImageIcon(JTableRenderer.class.getResource(IMAGE_PATH + "resize.gif")));
    label.setCursor(new Cursor(Cursor.NW_RESIZE_CURSOR));

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(label, BorderLayout.EAST);

    add(panel, BorderLayout.SOUTH);

    ResizeHandler resizeHandler = new ResizeHandler();
    label.addMouseListener(resizeHandler);
    label.addMouseMotionListener(resizeHandler);

    setMinimumSize(new Dimension(20, 30));
  }