コード例 #1
0
  public SidePaneComponent(SidePaneManager manager, Icon icon, String title) {
    super(title);
    this.manager = manager;

    this.add(new JLabel(icon));

    setTitleForeground(new Color(79, 95, 143));
    setBorder(BorderFactory.createEmptyBorder());

    close.setMargin(new Insets(0, 0, 0, 0));
    close.setBorder(null);
    close.addActionListener(e -> hideAway());

    JButton up = new JButton(IconTheme.JabRefIcon.UP.getSmallIcon());
    up.setMargin(new Insets(0, 0, 0, 0));
    up.setBorder(null);
    up.addActionListener(e -> moveUp());

    JButton down = new JButton(IconTheme.JabRefIcon.DOWN.getSmallIcon());
    down.setMargin(new Insets(0, 0, 0, 0));
    down.setBorder(null);
    down.addActionListener(e -> moveDown());

    JToolBar tlb = new OSXCompatibleToolbar();
    tlb.add(up);
    tlb.add(down);
    tlb.add(close);
    tlb.setOpaque(false);
    tlb.setFloatable(false);
    this.getUI().getTitleBar().add(tlb);
    setTitlePainter(new MattePainter(Color.lightGray));
  }
コード例 #2
0
  private void buttonFactory() {
    runButton = new JButton(Constants.runAssociationButtonText);
    runButton.setBorder(BorderFactory.createRaisedBevelBorder());
    runButton.setEnabled(true);
    runButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            runButtonActionPerformed(e);
          }
        });

    cancelButton = new JButton(Constants.cancelButtonText);
    cancelButton.setBorder(BorderFactory.createRaisedBevelBorder());
    cancelButton.setEnabled(true);
    cancelButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            dispose();
          }
        });

    browseButton = new JButton(Constants.browseAssociationButtonText);
    browseButton.setBorder(BorderFactory.createRaisedBevelBorder());
    browseButton.setEnabled(false);
    browseButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            browseButtonActionPerformed(e);
          }
        });
  }
コード例 #3
0
ファイル: Perfil.java プロジェクト: alejo120/-2015
  public Perfil() {
    super.setBounds(181, 61, 700, 538); // (ancho,alto)
    super.setLayout(null);
    super.setOpaque(false);
    super.setVisible(false);

    try {
      UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    } catch (Exception ex) {
      ex.printStackTrace();
    }

    jbtnGuardar = new JButton("Guardar Cambios");
    jbtnGuardar.setBounds(55, 457, 150, 40);
    jbtnGuardar.addActionListener(this);
    jbtnGuardar.setBorder(null);
    jbtnGuardar.setBackground(new Color(0, 154, 225));
    jbtnGuardar.setForeground(Color.WHITE);
    jbtnGuardar.setFont(new Font("Segoe UI", Font.PLAIN, 14));
    jbtnGuardar.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR));
    jbtnGuardar.setFocusPainted(false);
    this.add(jbtnGuardar);

    nombre = new JLabel("Ninguna imagen seleccionada");
    nombre.setBounds(210, 250, 200, 40);
    nombre.setForeground(Color.GRAY);
    this.add(nombre);

    jbtnCargarI = new JButton("Cargar imagen");
    jbtnCargarI.setBounds(55, 250, 150, 40);
    jbtnCargarI.addActionListener(this);
    jbtnCargarI.setBorder(null);
    jbtnCargarI.setBackground(new Color(0, 154, 225));
    jbtnCargarI.setForeground(Color.WHITE);
    jbtnCargarI.setFont(new Font("Segoe UI", Font.PLAIN, 14));
    jbtnCargarI.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR));
    jbtnCargarI.setFocusPainted(false);
    this.add(jbtnCargarI);

    jbtnQuitarI = new JButton("Quitar imagen");
    jbtnQuitarI.setBounds(55, 186, 150, 40);
    jbtnQuitarI.addActionListener(this);
    jbtnQuitarI.setBorder(null);
    jbtnQuitarI.setBackground(new Color(0, 154, 225));
    jbtnQuitarI.setForeground(Color.WHITE);
    jbtnQuitarI.setFont(new Font("Segoe UI", Font.PLAIN, 14));
    jbtnQuitarI.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR));
    jbtnQuitarI.setFocusPainted(false);
    this.add(jbtnQuitarI);

    jlbimage = new JLabel();
    jlbimage.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1));
    jlbimage.setBounds(55, 46, 150, 150);
    this.add(jlbimage);

    this.repaint();
  }
コード例 #4
0
ファイル: KodeKsToolBar.java プロジェクト: K-nud/KodeKs
  /**
   * @param listener - GUI
   * @param size - Dimension
   */
  public KodeKsToolBar(GUI listener, Dimension size) {

    setPreferredSize(size);
    setOpaque(true);
    setBorder(BorderFactory.createBevelBorder(VERTICAL));

    JButton ToolBarItem_NGame = new JButton("   New Game   ");
    ToolBarItem_NGame.setPreferredSize(new Dimension(128, size.height));
    ToolBarItem_NGame.setBorder(BorderFactory.createRaisedBevelBorder());
    ToolBarItem_NGame.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            new NewGameDialog();
          }
        });

    add(ToolBarItem_NGame);

    JButton ToolBarItem_Load = new JButton("   Load   ");
    ToolBarItem_Load.setPreferredSize(new Dimension(128, size.height));
    ToolBarItem_Load.setBorder(BorderFactory.createRaisedBevelBorder());
    ToolBarItem_Load.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            new LoadGame();
          }
        });

    JButton ToolBarItem_Save = new JButton("   Save   ");
    ToolBarItem_Save.setPreferredSize(new Dimension(128, size.height));
    ToolBarItem_Save.setBorder(BorderFactory.createRaisedBevelBorder());
    ToolBarItem_Save.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            new SaveGame();
          }
        });

    JButton ToolBarItem_Resign = new JButton("   Resign   ");
    ToolBarItem_Resign.setPreferredSize(new Dimension(128, size.height));
    ToolBarItem_Resign.setBorder(BorderFactory.createRaisedBevelBorder());
    ToolBarItem_Resign.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            new ResignDialog();
          }
        });

    setFloatable(false);
    add(ToolBarItem_NGame);
    add(ToolBarItem_Load);
    add(ToolBarItem_Save);
    add(ToolBarItem_Resign);

    add(Box.createHorizontalGlue());
  }
コード例 #5
0
    ImDocumentEditorDialog(
        GoldenGATE host,
        String title,
        MutableAnnotation content,
        int contentFlags,
        Set taggedAnnotTypes,
        Set highlightedAnnotTypes,
        Map annotTypeColors) {
      super(host, title, content);

      for (Iterator tit = annotTypeColors.keySet().iterator(); tit.hasNext(); ) {
        String annotType = ((String) tit.next());
        Color annotColor = ((Color) annotTypeColors.get(annotType));
        if (annotColor != null) this.documentEditor.setAnnotationColor(annotType, annotColor);
      }
      for (Iterator tit = taggedAnnotTypes.iterator(); tit.hasNext(); )
        this.documentEditor.setAnnotationTagVisible(((String) tit.next()), true);
      for (Iterator tit = highlightedAnnotTypes.iterator(); tit.hasNext(); )
        this.documentEditor.setAnnotationValueHighlightVisible(((String) tit.next()), true);

      this.contentFlags = contentFlags;

      JButton ok = new JButton("OK");
      ok.setBorder(BorderFactory.createRaisedBevelBorder());
      ok.setPreferredSize(new Dimension(100, 21));
      ok.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
              dispose(isContentModified());
            }
          });
      this.mainButtonPanel.add(ok);

      JButton cancel = new JButton("Cancel");
      cancel.setBorder(BorderFactory.createRaisedBevelBorder());
      cancel.setPreferredSize(new Dimension(100, 21));
      cancel.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
              dispose(false);
            }
          });
      this.mainButtonPanel.add(cancel);

      JButton customize = new JButton("Customize");
      customize.setBorder(BorderFactory.createRaisedBevelBorder());
      customize.setPreferredSize(new Dimension(100, 21));
      customize.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
              customizeContent();
            }
          });
      this.mainButtonPanel.add(customize);
    }
コード例 #6
0
ファイル: BaseComboBoxUI.java プロジェクト: kerberos20/aion-
 public JButton createArrowButton() {
   JButton button = new ArrowButton();
   if (Utilities.isLeftToRight(comboBox)) {
     Border border = BorderFactory.createMatteBorder(0, 1, 0, 0, BaseLookAndFeel.getFrameColor());
     button.setBorder(border);
   } else {
     Border border = BorderFactory.createMatteBorder(0, 0, 0, 1, BaseLookAndFeel.getFrameColor());
     button.setBorder(border);
   }
   return button;
 }
コード例 #7
0
 public void updateKeyboardUI() {
   if (Skin.VIETNAMESE_KEY.isEnabled()) {
     chkVietnamese.setText(" V ");
     chkVietnamese.setBackground(Color.yellow);
     chkVietnamese.setBorder(BorderFactory.createLineBorder(Color.red, 1));
   } else {
     chkVietnamese.setText(" E ");
     chkVietnamese.setBackground(Color.cyan);
     chkVietnamese.setBorder(BorderFactory.createLineBorder(Color.blue, 1));
   }
 }
コード例 #8
0
  /** Enters full screen mode and changes the display mode. */
  public void setFullScreen(DisplayMode displayMode, JFrame window) {

    window.setUndecorated(true);
    window.setResizable(false);
    cmdemo bgd = new cmdemo();
    JList mission = new JList(string);
    mission.setVisibleRowCount(4);
    JScrollPane pane = new JScrollPane(mission);
    pane.setBounds(400, 400, 225, 70);
    window.getContentPane().add(pane);

    muButton.setBounds(764 - 120, 625 - 10, 225, 49);
    textField1.setBounds(630 - 120, 328 - 10, 225, 25);
    window.getContentPane().add(muButton);
    window.getContentPane().add(textField1);
    // window.add(bgd);
    muButton.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION);
    muButton.setToolTipText("start");
    muButton.setBorder(null);
    muButton.setRolloverIcon(new javax.swing.ImageIcon("imgs/start1.jpg"));
    muButton.addActionListener(
        new java.awt.event.ActionListener() {

          public void actionPerformed(java.awt.event.ActionEvent evt) {
            startActionPerformed(evt);
          }
        });

    aButton.setBounds(284 - 120, 625 - 10, 225, 49);
    window.getContentPane().add(aButton);
    window.add(bgd);
    aButton.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION);
    aButton.setToolTipText("back");
    aButton.setBorder(null);
    aButton.setRolloverIcon(new javax.swing.ImageIcon("imgs/back1.jpg"));

    aButton.addActionListener(
        new java.awt.event.ActionListener() {

          public void actionPerformed(java.awt.event.ActionEvent evt) {
            backActionPerformed(evt);
          }
        });

    device.setFullScreenWindow(window);
    if (displayMode != null && device.isDisplayChangeSupported()) {
      try {
        device.setDisplayMode(displayMode);
      } catch (IllegalArgumentException ex) {
        // ignore - illegal mode for this device
      }
    }
  }
コード例 #9
0
ファイル: Frame.java プロジェクト: danalor1/2048-java
  public Frame(boolean isStar) {
    super("2048");
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setLayout(new BorderLayout());
    this.isStar = isStar;

    background = new JLabel(new ImageIcon("Images\\background.png"));
    this.setResizable(false);
    add(background);
    background.setLayout(new FlowLayout());
    newGameButton = new JButton(new ImageIcon("Images\\newGame.png"));
    recordTableButton = new JButton(new ImageIcon("Images\\recordTableButton.png"));
    designButton = new JButton(new ImageIcon("Images\\changeDesign.png"));
    newGameButton.setBorder(BorderFactory.createEmptyBorder());
    newGameButton.setContentAreaFilled(false);
    recordTableButton.setBorder(BorderFactory.createEmptyBorder());
    recordTableButton.setContentAreaFilled(false);
    designButton.setBorder(BorderFactory.createEmptyBorder());
    designButton.setContentAreaFilled(false);
    background.add(newGameButton);
    background.add(recordTableButton);
    background.add(designButton);
    newGameButton.addActionListener(this);
    recordTableButton.addActionListener(this);
    designButton.addActionListener(this);
    this.addKeyListener(this);
    board = new Board(highscores, this);
    this.pack();
    nextImage = new JLabel(new ImageIcon("images\\next2.png"));
    background.add(board.getBoard());
    background.add(nextImage);
    background.add(board.getScoreLabel());
    if (isStar != this.board.getChangedDesign()) {
      this.board.ChaneDesign();

      background.setIcon(new ImageIcon("Images\\Background2.png"));
      newGameButton.setIcon(new ImageIcon("Images\\newGameStar.png"));
      recordTableButton.setIcon(new ImageIcon("Images\\recordTableStarButton.png"));
      designButton.setIcon(new ImageIcon("Images\\changeDesignStar.png"));
      nextImage.setIcon(new ImageIcon("Images\\next2Star.png"));
      this.board.getScoreLabel().setText("Stars collected:" + this.board.getScore().getScore());
    }

    // board.ChaneDesign();

    this.setSize(476, 570);
    this.pack();
    this.setVisible(true);
    this.requestFocusInWindow();
  }
コード例 #10
0
ファイル: Login.java プロジェクト: jarekjj/training
  public Login() {

    Image titleImage = Toolkit.getDefaultToolkit().getImage("logo.jpg");
    con = getContentPane();
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setTitle("Brain Tumor Segmentation");
    setBounds(125, 50, 800, 600);
    setIconImage(titleImage);
    con.setLayout(null);
    con.add(panel);
    panel.setLayout(null);
    panel.setBounds(15, 10, 760, 540);
    panel.setBorder(new TitledBorder("Login Page"));
    panel.setBackground(Color.lightGray);

    panel.add(index);
    panel.add(userid);
    panel.add(password);
    panel.add(useridTxt);
    panel.add(passwordTxt);
    panel.add(submit);
    panel.add(exit);

    Font font = new Font("Bookman Old Style", 1, 15);

    index.setBounds(260, 50, 350, 30);
    userid.setBounds(250, 125, 125, 30);
    useridTxt.setBounds(400, 125, 125, 30);
    password.setBounds(250, 200, 175, 30);
    passwordTxt.setBounds(400, 200, 125, 30);
    submit.setBounds(275, 300, 125, 50);
    exit.setBounds(425, 300, 125, 50);

    index.setFont(new Font("Bookman Old Style", 1, 18));
    userid.setFont(font);
    useridTxt.setFont(font);
    password.setFont(font);
    passwordTxt.setFont(font);
    submit.setFont(font);
    exit.setFont(font);

    submit.setBorder(BorderFactory.createLineBorder(Color.black, 5));
    exit.setBorder(BorderFactory.createLineBorder(Color.black, 5));
    setVisible(true);

    submit.addActionListener(this);
    exit.addActionListener(this);
  }
コード例 #11
0
  private void jbInit() throws Exception {
    // this.setResizable(false);
    this.setSize(ancho, alto);
    this.setLocation(0, 0);

    // this.setUndecorated(true);
    // this.getContentPane().setLayout(null);

    // limites de componentes
    labelFondo.setBounds(
        new Rectangle((int) (ancho / 5), 2 * (alto / 6), (int) (ancho / 1.5), alto / 4));
    botonCancelar.setBounds(
        new Rectangle(
            (int) (2.9 * (ancho / 5)), (int) (2 * (alto / 4)), (int) (ancho / 10.2), alto / 25));
    botonCancelar.setBorder(null);
    // botonAceptar.setBounds(new Rectangle(0, 0, 100, 30));
    botonAceptar.setBounds(
        new Rectangle(
            (int) (2.15 * (ancho / 5)), (int) (2 * (alto / 4)), (int) (ancho / 10.2), alto / 25));
    botonAceptar.setBorder(null);
    textNombre.setFont(new java.awt.Font("Serif", 3, 15));
    textNombre.setBounds(
        new Rectangle((int) (2.5 * (ancho / 5)), (int) (1.5 * (alto / 4)), ancho / 5, alto / 25));
    textNombre.addKeyListener(new PanelNick_textNombre_keyAdapter(this));

    textContra.setFont(new java.awt.Font("Serif", 3, 15));
    textContra.setBounds(
        new Rectangle(
            (int) (2.9 * (ancho / 5)), (int) (1.65 * (alto / 4)) + 20, ancho / 8, alto / 25));

    // imagenes de componentes
    labelFondo.setIcon(new ImageIcon("../imagenes/introduceNick.jpg"));
    botonCancelar.setIcon(new ImageIcon("../imagenes/botoncancelar.jpg"));
    botonCancelar.addMouseListener(new PanelNick_botonCancelar_mouseAdapter(this));
    botonAceptar.setIcon(new ImageIcon("../imagenes/botonaceptar.jpg"));
    botonAceptar.addMouseListener(new PanelNick_botonAceptar_mouseAdapter(this));

    // agregar componentes al panel
    this.add(textContra, null);
    this.add(botonCancelar, null);
    this.add(botonAceptar, null);
    this.add(textNombre, null);
    this.add(labelFondo, null);

    // acciones de botones
    botonAceptar.addActionListener(new PanelNick_botonAceptar_actionAdapter(this));
    botonCancelar.addActionListener(new PanelNick_botonCancelar_actionAdapter(this));
  }
コード例 #12
0
ファイル: ChessGui.java プロジェクト: yaozjalex/Chess
    public BoardWindow() {
      jButtonList = new JButton[8][8];
      setLayout(new GridBagLayout());
      GridBagConstraints blk = new GridBagConstraints();
      for (int rank = 0; rank < 8; rank++) {
        for (int file = 0; file < 8; file++) {
          blk.gridy = rank;
          blk.gridx = file;

          // Set chessPiece as JButton
          JButton button = new JButton();
          Image temp = null;
          if (game.gameBoard.spaces[rank][file] != null) {
            temp = game.gameBoard.spaces[rank][file].getBufferedImage();
            button.setIcon(new ImageIcon(temp));
          }
          button.setBorderPainted(true);
          button.setPreferredSize(new Dimension(100, 100));
          Border thickBorder = new LineBorder(Color.BLACK, 1);
          button.setBorder(thickBorder);
          MyActionListener check = new MyActionListener();
          button.addActionListener(check);
          add(button, blk);
          jButtonList[rank][file] = button;
        }
      }
    }
コード例 #13
0
ファイル: VideoPanel.java プロジェクト: XsubinX/cats
  /*
   * Initialise Components
   */
  private void initComponents() {
    selectionCheckBox = new JCheckBox();

    selectionCheckBox.setText(settop.getHostMacAddress());

    selectionCheckBox.setFocusable(false);

    // selectionCheckBox.setEnabled( false );

    selectionCheckBox.setName("selectionCheckBox");

    closeButton = new IconButton(CLOSE_ICON);

    closeButton.setToolTipText("Close Video");

    playStopButton = new IconButton(STOP_ICON);

    showStopStreamingButton();

    lockUnlockButton = new IconButton(UNLOCK_ICON);

    lockUnlockButton.setSize(new Dimension(25, 25));

    showUnLockButton();

    closeButton.setBorder(BorderFactory.createRaisedBevelBorder());

    setToolTipText(getSettopInfoToolTipText((SettopInfo) settop));
  }
コード例 #14
0
ファイル: TeamPanel.java プロジェクト: BigBlackBug/lolClient
    public ChampSelectCellRenderer() {
      setOpaque(true);
      mainPan = new JPanel();
      mainPan.setLayout(new BoxLayout(mainPan, BoxLayout.Y_AXIS));

      sumName = new JLabel("");
      sumName.setAlignmentX(Component.LEFT_ALIGNMENT);
      JPanel top = new JPanel(new FlowLayout(FlowLayout.LEFT));
      top.add(sumName);
      mainPan.add(top);

      JPanel iconsPanel = new JPanel(new GridLayout(1, 2));

      chmpI = new JButton();
      chmpI.setBorder(BorderFactory.createEmptyBorder());
      iconsPanel.add(chmpI);

      JPanel spellsPan = new JPanel(new GridLayout(2, 1));
      spell1 = new JLabel("", JLabel.CENTER);
      spell1.setBorder(BorderFactory.createEmptyBorder());
      spell2 = new JLabel("", JLabel.CENTER);
      spell2.setBorder(BorderFactory.createEmptyBorder());
      spellsPan.add(spell1);
      spellsPan.add(spell2);

      iconsPanel.add(spellsPan);

      mainPan.add(iconsPanel);
    }
コード例 #15
0
ファイル: source.java プロジェクト: Khaleesy/JAVA
  public static void main(String[] args) {
    JFrame frame = new JFrame("Program Okienkowy - Testowy"); // utworzenie ramki z tytulem
    frame.setSize(550, 350); // rozmiar dlugoscXwysokosc
    frame.setLocation(300, 300); // polozenie od lewego gornego rogu
    frame.setResizable(false); // false - nie mozna zmieniac rozmiaru okna( strzalkami )
    frame.setLayout(null); // widoczne pola na tle

    JTextField tekstField = new JTextField(); // pole tekstowe
    tekstField.setBounds(10, 10, 230, 50); // lokalizacja pola tekstowego i rozmiar
    Font font = new Font("Times New Roman", Font.BOLD, 14); // utworzenie czcionki w polu tekstowym
    tekstField.setFont(font); // ustawienie czcionki w polu tekstowym
    tekstField.setText(
        "Pole tekstowe - testowe"); // ustawienie poczatkowego tekstu w polu tekstowym
    frame.add(tekstField); // dodanie pola tekstowego do ramki

    JButton button = new JButton("Testowy Przycisk"); // tworzenie przycisku o tytule
    button.setBounds(300, 10, 230, 50); // lokalziacja i rozmiar buttonu
    button.setBorder(null); // null - wtopiony w tlo
    button.addActionListener(
        new ActionListener() { // funkcja dodaje AKCJE do przycisku
          public void actionPerformed(ActionEvent arg0) { // implementowana metoda
            int standardValue = 976;
            tekstField.setText("Tekst po nacisnieciu przycisku: " + standardValue); // zwykly test
          }
        });
    frame.add(button); // dodanie buttony do ramki

    frame.setVisible(true); // widocznosc
  }
 public SummaryViewDeleteCellTableEditor(SummaryView view, JTable table) {
   this.view = view;
   this.table = table;
   button = new JButton(Messages.getString("Delete"));
   button.addActionListener(this);
   button.setBorder(BorderFactory.createEmptyBorder());
 }
コード例 #17
0
ファイル: RefuteDialog.java プロジェクト: ChrisChin/Cluedo
 /**
  * Helper method makes simple scrollable panel full of possible responses.
  *
  * @param c Character accused
  * @param w Weapon accused
  * @param r Room accused
  * @return scroll panel of buttons
  */
 private JScrollPane cardsPanel(Character c, Weapon w, Room r) {
   JPanel panel = new JPanel(new FlowLayout()); // perhaps boxlayout along x
   JScrollPane pane =
       new JScrollPane(
           panel,
           JScrollPane.VERTICAL_SCROLLBAR_NEVER,
           JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   for (Card crd : player.getCards()) {
     if (crd.toString().equals(c.getName())
         || crd.toString().equals(w.getName())
         || crd.toString().equals(r.toString())) {
       refutable = true;
       JButton l = new JButton(new ImageIcon(crd.getCardImg()));
       final Card refW = crd;
       l.addActionListener(
           new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent arg0) {
               refutedWith = refW;
             }
           });
       l.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
       l.setBorder(new EmptyBorder(10, 10, 10, 10));
       panel.add(l);
     }
   }
   return pane;
 }
コード例 #18
0
  /**
   * Description of the Method
   *
   * @exception Exception Description of Exception
   */
  private void jbInit() throws Exception {

    this.setLayout(null);
    this.setSize(700, 500);
    this.setLocation(0, 0);

    // limites de componentes
    labelFondo.setBounds(new Rectangle((int) (ancho / 3.5), 2 * (alto / 6), ancho / 2, alto / 4));

    botonAceptar.setBounds(
        new Rectangle(
            (int) (2.4 * (ancho / 5)), (int) (1.9 * (alto / 4)), (int) (ancho / 10.2), alto / 25));
    botonAceptar.setBorder(null);

    // imagenes de componentes
    labelFondo.setIcon(new ImageIcon(Imagen));

    botonAceptar.setIcon(new ImageIcon("../imagenes/botonaceptar.jpg"));
    botonAceptar.addMouseListener(new PanelGenerico_botonAceptar_mouseAdapter(this));

    // agregar componentes al panel

    this.add(botonAceptar, null);
    this.add(labelFondo, null);
    this.setBackground(SystemColor.menuText);

    // acciones de botones
    botonAceptar.addActionListener(new PanelGenerico_botonAceptar_actionAdapter(this));
  }
コード例 #19
0
ファイル: TreeNodeAllsky.java プロジェクト: jankotek/asterope
 void setCopyright(String copyright) {
   Component c = null;
   if (copyrightUrl == null) {
     JLabel l = new JLabel("(" + copyright + ")");
     c = l;
     gc.insets.bottom = 0;
   } else {
     JButton b = new JButton(copyright != null ? copyright : "Copyright");
     b.setFont(b.getFont().deriveFont(Font.ITALIC));
     b.setForeground(Color.blue);
     b.setBackground(background);
     b.setContentAreaFilled(false);
     b.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.blue));
     b.addActionListener(
         new ActionListener() {
           public void actionPerformed(ActionEvent e) {
             loadCopyright();
           }
         });
     c = b;
     gc.insets.bottom = 5;
   }
   gb.setConstraints(c, gc);
   getPanel().add(c);
 }
コード例 #20
0
ファイル: TryGridLayout.java プロジェクト: cstrahan/aduni
  public static void main(String[] args) {
    Toolkit theKit = aWindow.getToolkit(); // Get the window Toolkit
    Dimension wndSize = theKit.getScreenSize(); // Get the screen size

    // Set the position to screen center & size to half screen size
    aWindow.setBounds(
        wndSize.width / 4,
        wndSize.height / 4, // Position
        wndSize.width / 2,
        wndSize.height / 2); // Size
    aWindow.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    GridLayout grid = new GridLayout(5, 2, 30, 20); // Create a layout manager
    Container content = aWindow.getContentPane();
    content.setLayout(grid);

    EtchedBorder edge = new EtchedBorder(EtchedBorder.RAISED); // Button border

    // Now add ten Button compenents
    JButton button;
    for (int i = 1; i <= 10; i++) {
      content.add(button = new JButton("Press " + i));
      button.setBorder(edge);
    }

    aWindow.getContentPane().setBackground(new Color(238, 233, 233));
    aWindow.setVisible(true);
  }
コード例 #21
0
 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);
 }
コード例 #22
0
 private ButtonColumn(Action action) {
   this.action = action;
   renderButton = new JButton();
   editButton = new JButton();
   editButton.setFocusPainted(false);
   editButton.addActionListener(this);
   editButton.setBorder(new LineBorder(Color.BLUE));
 }
コード例 #23
0
 /**
  * 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;
 }
コード例 #24
0
    public IconButton(Icon[] icons) {
      this.icons = icons;
      super.setBorder(emptyBorder);
      setState(UP);
      setContentAreaFilled(false);

      addMouseListener(this);
    }
コード例 #25
0
  @Override
  protected JButton createIncreaseButton(int orientation) {
    JButton button = super.createIncreaseButton(orientation);
    button.setBackground(Color.BLACK);
    button.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));

    return button;
  }
コード例 #26
0
  private void prepareTileStoreInfoPanel() {

    final GridBagConstraints gbc_mapSource = new GridBagConstraints();
    gbc_mapSource.insets = new Insets(5, 10, 5, 10);
    gbc_mapSource.anchor = GridBagConstraints.WEST;
    final GridBagConstraints gbc_mapTiles = new GridBagConstraints();
    gbc_mapTiles.insets = gbc_mapSource.insets;
    gbc_mapTiles.anchor = GridBagConstraints.EAST;
    final GridBagConstraints gbc_eol = new GridBagConstraints();
    gbc_eol.gridwidth = GridBagConstraints.REMAINDER;

    TileStore tileStore = TileStore.getInstance();
    MapSourcesManager mapSourcesManager = MapSourcesManager.getInstance();

    tileStoreInfoPanel.add(new JLabel("<html><b>Map source</b></html>"), gbc_mapSource);
    tileStoreInfoPanel.add(new JLabel("<html><b>Tiles</b></html>"), gbc_mapTiles);
    tileStoreInfoPanel.add(new JLabel("<html><b>Size</b></html>"), gbc_eol);

    ImageIcon trash = Utilities.loadResourceImageIcon("trash.png");

    for (String name : tileStore.getAllStoreNames()) {
      String mapTileCountText = "  ?  ";
      String mapTileSizeText = "    ?    ";
      MapSource mapSource = mapSourcesManager.getSourceByName(name);
      final JLabel mapSourceNameLabel;
      if (mapSource != null) mapSourceNameLabel = new JLabel(name);
      else mapSourceNameLabel = new JLabel(name + " (unused)");
      final JLabel mapTileCountLabel = new JLabel(mapTileCountText);
      final JLabel mapTileSizeLabel = new JLabel(mapTileSizeText);
      final JButton deleteButton = new JButton(trash);
      TileSourceInfoComponents info = new TileSourceInfoComponents();
      info.name = name;
      info.countLabel = mapTileCountLabel;
      info.sizeLabel = mapTileSizeLabel;
      tileStoreInfoList.add(info);
      deleteButton.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
      deleteButton.setToolTipText("Delete all stored " + name + " tiles.");
      deleteButton.addActionListener(new ClearTileCacheAction(name));

      tileStoreInfoPanel.add(mapSourceNameLabel, gbc_mapSource);
      tileStoreInfoPanel.add(mapTileCountLabel, gbc_mapTiles);
      tileStoreInfoPanel.add(mapTileSizeLabel, gbc_mapTiles);
      tileStoreInfoPanel.add(deleteButton, gbc_eol);
    }
    JSeparator hr = new JSeparator(JSeparator.HORIZONTAL);
    hr.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    tileStoreInfoPanel.add(hr, gbc);

    JLabel totalMapLabel = new JLabel("<html><b>Total</b></html>");
    totalTileCountLabel = new JLabel("<html><b>??</b></html>");
    totalTileSizeLabel = new JLabel("<html><b>??</b></html>");
    tileStoreInfoPanel.add(totalMapLabel, gbc_mapSource);
    tileStoreInfoPanel.add(totalTileCountLabel, gbc_mapTiles);
    tileStoreInfoPanel.add(totalTileSizeLabel, gbc_mapTiles);
  }
コード例 #27
0
  /**
   * Erstellt die grafische Oberfläche.
   *
   * @throws Exception
   */
  private void jbInit() throws Exception {
    contentPane = (JPanel) this.getContentPane();
    m_agentLabel.setBorder(BorderFactory.createEtchedBorder());
    m_agentLabel.setMaximumSize(new Dimension(150, 20));
    m_agentLabel.setMinimumSize(new Dimension(150, 20));
    m_agentLabel.setPreferredSize(new Dimension(150, 20));
    m_agentLabel.setToolTipText("Name des Agenten");
    m_agentLabel.setText("Agenten Name:");
    m_gridLayout.setColumns(3);
    m_gridLayout.setHgap(10);
    m_gridLayout.setRows(4);
    m_gridLayout.setVgap(10);
    contentPane.setLayout(m_gridLayout);
    this.setSize(new Dimension(581, 212));
    this.setTitle("Agentenanmeldung");
    contentPane.setMaximumSize(new Dimension(300, 32767));
    contentPane.setMinimumSize(new Dimension(300, 80));
    contentPane.setPreferredSize(new Dimension(300, 80));
    m_agentClass.setBorder(BorderFactory.createEtchedBorder());
    m_agentClass.setText("Klasse des Agenten:");
    m_serverLabel.setBorder(BorderFactory.createEtchedBorder());
    m_serverLabel.setText("Source-Server:");
    m_agentTF.setText("");
    m_roVButton.setBorder(BorderFactory.createRaisedBevelBorder());
    m_roVButton.setActionCommand("Registriere Agent ohne Visualisierung");
    m_roVButton.setText("Registriere Agent ohne Visualisierung");
    m_roVButton.addActionListener(new AgentRegistrationFrame_m_roVButton_actionAdapter(this));
    m_rwVAgentButton.setBorder(BorderFactory.createRaisedBevelBorder());
    m_rwVAgentButton.setText("Registriere Agent mit Visualisierung");
    m_rwVAgentButton.addActionListener(
        new AgentRegistrationFrame_m_rwVAgentButton_actionAdapter(this));

    m_rwVAgentButton.setVisible(false); // später auf true setzten

    m_agentClassCombo = new JComboBox(this.getAgentClasses());
    m_serverTF.setText("http://localhost:2003/");
    contentPane.add(m_agentLabel, null);
    contentPane.add(m_agentTF, null);
    contentPane.add(m_agentClass, null);
    contentPane.add(m_agentClassCombo, null);
    contentPane.add(m_serverLabel, null);
    contentPane.add(m_serverTF, null);
    contentPane.add(m_roVButton, null);
    contentPane.add(m_rwVAgentButton, null);
  }
コード例 #28
0
ファイル: GUILogin.java プロジェクト: charleshans/PQQ
 public void setButton(JButton jbtn) {
   jbtn.setOpaque(false);
   jbtn.setMargin(new Insets(0, 0, 0, 0));
   jbtn.setContentAreaFilled(false);
   jbtn.setFocusPainted(false);
   jbtn.setBorderPainted(false);
   jbtn.setBorder(null);
   jbtn.addMouseListener(new ButtonListener());
 }
コード例 #29
0
ファイル: Calculator.java プロジェクト: CurtainTears/Mygit
  /** 初始化操作 添加按钮 */
  private void init() {
    addButton(panel1, "Backspace", new Clear(), Color.red);
    addButton(panel1, "CE", new Clear(), Color.red);
    addButton(panel1, "C", new Clear(), Color.red);
    addButton(panel2, "1/x", new Signs(), Color.magenta);
    addButton(panel2, "log", new Signs(), Color.magenta);
    addButton(panel2, "7", numActionListener, Color.blue);
    addButton(panel2, "8", numActionListener, Color.blue);
    addButton(panel2, "9", numActionListener, Color.blue);
    addButton(panel2, "÷", new Signs(), Color.red);
    addButton(panel2, "n!", new Signs(), Color.magenta);
    addButton(panel2, "sqrt", new Signs(), Color.magenta);
    addButton(panel2, "4", numActionListener, Color.blue);
    addButton(panel2, "5", numActionListener, Color.blue);
    addButton(panel2, "6", numActionListener, Color.blue);
    addButton(panel2, "×", new Signs(), Color.red);
    addButton(panel2, "sin", new Signs(), Color.magenta);
    addButton(panel2, "x^2", new Signs(), Color.magenta);
    addButton(panel2, "1", numActionListener, Color.blue);
    addButton(panel2, "2", numActionListener, Color.blue);
    addButton(panel2, "3", numActionListener, Color.blue);
    addButton(panel2, "-", new Signs(), Color.red);
    addButton(panel2, "cos", new Signs(), Color.magenta);
    addButton(panel2, "x^3", new Signs(), Color.magenta);
    addButton(panel2, "0", numActionListener, Color.blue);
    addButton(panel2, "-/+", new Clear(), Color.blue);
    addButton(panel2, ".", new Dot(), Color.blue);
    addButton(panel2, "+", new Signs(), Color.red);
    addButton(panel2, "tan", new Signs(), Color.magenta);
    addButton(panel2, "%", new Signs(), Color.magenta);
    addButton(panel2, "π", numActionListener, Color.orange);
    addButton(panel2, "e", numActionListener, Color.orange);
    addButton(panel2, "′″", new Signs(), Color.orange);
    addButton(panel2, "=", new Signs(), Color.red);

    JButton btns = new JButton("计算器");
    btns.setBorder(BorderFactory.createLoweredBevelBorder());
    btns.setEnabled(false); // 按钮不可操作
    btns.setPreferredSize(new Dimension(20, 20));

    panel3.add(btns); // 加入按钮
    addButton(panel3, "MC", null, Color.red);
    addButton(panel3, "MR", null, Color.red);
    addButton(panel3, "MS", null, Color.red);
    addButton(panel3, "M+", null, Color.red);

    panel4.add(panel1, BorderLayout.NORTH);
    panel4.add(panel2, BorderLayout.CENTER);
    this.add(tf, BorderLayout.NORTH);
    this.add(panel3, BorderLayout.WEST);
    this.add(panel4);

    pack();
    this.setResizable(false); // 窗口不可改变大小
    this.setLocation(300, 200);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
コード例 #30
0
 public void addToToolbar(Action action, Activator activator) {
   JButton button = toolbar.add(makeToolbarAction(action));
   button.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 5));
   button.setOpaque(false);
   button.setMargin(new Insets(1, 1, 1, 1));
   if (activator != null) {
     registerComponent(button, activator);
   }
 }