Exemplo n.º 1
0
  void makeFrame() {
    JPanel p = new JPanel();
    p.setBackground(Color.blue);
    p.setLayout(new BorderLayout(0, 0));
    p.setBorder(new EmptyBorder(0, GAP, GAP, GAP));
    days.setFont(BIG);
    days.setForeground(COLOR);
    p.add(days, "North");
    left.setFont(NORM);
    left.setForeground(COLOR);
    p.add(left, "South");

    JFrame f = new JFrame("Sayaç"); // a window
    f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    f.setContentPane(p);
    setDate();
    f.pack(); // minimal size
    f.setVisible(true); // show

    f.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            stop();
          }
        });
  }
Exemplo n.º 2
0
  public LoginFrame() {
    super("Kullanıcı Giriş Ekranı");
    setLayout(new FlowLayout(FlowLayout.LEFT));

    kullaniciAdi = new JLabel("Kullanıcı Adı");
    kullaniciAdi.setFont(new Font("Dialog", Font.BOLD, 15));
    add(kullaniciAdi);

    txt1 = new JTextField(10);
    add(txt1);
    txt1.addActionListener(this);

    sifre = new JLabel("Şifre");
    sifre.setFont(new Font("Dialog", Font.BOLD, 15));
    add(sifre);

    txt2 = new JTextField(10);
    add(txt2);
    txt2.addActionListener(this);

    giris = new JButton("Giriş");
    add(giris);
    giris.addActionListener(this);

    pack();
  }
  public Welcome() {
    c.setLayout(null);

    c.add(welcome);
    welcome.setBounds(250, 100, 600, 50);
    welcome.setFont(font1);
    welcome.setForeground(Color.black);

    c.add(hotel);
    hotel.setBounds(350, 170, 700, 50);
    hotel.setFont(font2);
    hotel.setForeground(Color.black);

    c.add(check);
    check.setBounds(450, 350, 250, 50);
    check.addActionListener(this);

    c.add(order);
    order.setBounds(150, 350, 250, 50);
    order.addActionListener(this);

    c.add(bill);
    bill.setBounds(750, 350, 250, 50);
    bill.addActionListener(this);

    c.add(exit);
    exit.setBounds(40, 600, 130, 20);
    exit.addActionListener(this);

    c.add(back).setBounds(0, 0, 1800, 1000);
  }
    private JComponent createLogo() {
      NonOpaquePanel panel = new NonOpaquePanel(new BorderLayout());
      ApplicationInfoEx app = ApplicationInfoEx.getInstanceEx();
      JLabel logo = new JLabel(IconLoader.getIcon(app.getWelcomeScreenLogoUrl()));
      logo.setBorder(JBUI.Borders.empty(30, 0, 10, 0));
      logo.setHorizontalAlignment(SwingConstants.CENTER);
      panel.add(logo, BorderLayout.NORTH);
      JLabel appName = new JLabel(ApplicationNamesInfo.getInstance().getFullProductName());
      Font font = getProductFont();
      appName.setForeground(JBColor.foreground());
      appName.setFont(font.deriveFont(JBUI.scale(36f)).deriveFont(Font.PLAIN));
      appName.setHorizontalAlignment(SwingConstants.CENTER);
      String appVersion = "Version " + app.getFullVersion();

      if (app.isEAP() && app.getBuild().getBuildNumber() < Integer.MAX_VALUE) {
        appVersion += " (" + app.getBuild().asString() + ")";
      }

      JLabel version = new JLabel(appVersion);
      version.setFont(getProductFont().deriveFont(JBUI.scale(16f)));
      version.setHorizontalAlignment(SwingConstants.CENTER);
      version.setForeground(Gray._128);

      panel.add(appName);
      panel.add(version, BorderLayout.SOUTH);
      panel.setBorder(JBUI.Borders.emptyBottom(20));
      return panel;
    }
Exemplo n.º 5
0
  public GuiYahtzee() {
    final Match m = new Match();
    final JFrame f = new JFrame();
    JPanel titles = new JPanel();
    JPanel cheatok = new JPanel();

    titles.setLayout(new BorderLayout());
    JLabel maintitle = new JLabel("Yahtzee World!\nPlayer Details...");
    maintitle.setFont(new Font("SansSerif", Font.ITALIC, 24));
    JLabel instr =
        new JLabel("Type the name of each player (1 to " + Match.MAXPLAYERS + " players)");
    instr.setFont(new Font("SansSerif", Font.PLAIN, 16));
    titles.add(maintitle, "North");
    titles.add(instr, "South");

    JPanel names = new JPanel();
    JLabel l[] = new JLabel[Match.MAXPLAYERS];
    final JTextField t[] = new JTextField[Match.MAXPLAYERS];
    names.setLayout(new GridLayout(Match.MAXPLAYERS, 2));
    for (int player = 0; player < Match.MAXPLAYERS; player++) {
      l[player] = new JLabel("Player " + (player + 1) + " name");
      t[player] = new JTextField(20);
      names.add(l[player]);
      names.add(t[player]);
    }

    cheatok.setLayout(new BorderLayout());
    final JCheckBox cheat = new JCheckBox("Cheat", false);
    JButton ok = new JButton("OK");
    ok.addActionListener(
        new ActionListener() {
          // This method is called when the user clicks the JButton
          public void actionPerformed(ActionEvent e) {
            String name = "";
            for (int player = 0; player < Match.MAXPLAYERS; player++) {
              name = t[player].getText();
              if (name.length() != 0) m.addPlayer(name);
            }
            if (m.getNumPlayers() == 0) {
              m.addPlayer("DUMMY");
              System.out.println("No named players.  Inventing one called `DUMMY'");
            }
            GuiYahtzee me = new GuiYahtzee(m, cheat.isSelected());
            f.dispose();
          }
        });
    cheatok.add(cheat, "West");
    cheatok.add(ok, "East");

    f.add(titles, "North");
    f.add(names, "Center");
    f.add(cheatok, "South");
    f.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    f.pack();
    f.setVisible(true);
    f.setResizable(false);
  }
Exemplo n.º 6
0
 private void jbInit() throws Exception {
   this.getContentPane().setLayout(null);
   Bienvenue.setFont(new java.awt.Font("Garamond", 1, 24));
   Bienvenue.setForeground(SystemColor.textHighlight);
   Bienvenue.setRequestFocusEnabled(true);
   Bienvenue.setVerifyInputWhenFocusTarget(true);
   Bienvenue.setText("Bienvenue dans JChat");
   Bienvenue.setBounds(new Rectangle(125, 28, 305, 44));
   Pseudo_L.setFont(new java.awt.Font("Dialog", 1, 14));
   Pseudo_L.setText("Pseudonyme :");
   Pseudo_L.setBounds(new Rectangle(75, 94, 128, 28));
   nom.setText("");
   nom.setBounds(new Rectangle(229, 95, 108, 24));
   pwd.setText("");
   pwd.setBounds(new Rectangle(230, 135, 108, 25));
   pwd_L.setFont(new java.awt.Font("Dialog", 1, 14));
   pwd_L.setText("Mot de passe :");
   pwd_L.setBounds(new Rectangle(76, 133, 122, 31));
   gestionnaire_B gestionnaire = new gestionnaire_B();
   Connect.addActionListener(gestionnaire);
   Connect.setBackground(new Color(239, 240, 234));
   Connect.setBounds(new Rectangle(281, 251, 142, 30));
   Connect.setText("Connexion");
   Connect.setIcon(new ImageIcon(image_c));
   Annuler.addActionListener(gestionnaire);
   Annuler.setBackground(new Color(239, 240, 234));
   Annuler.setBounds(new Rectangle(104, 252, 140, 29));
   Annuler.setText("Annuler");
   Annuler.setIcon(new ImageIcon(image_d));
   this.getContentPane().setBackground(new Color(239, 240, 234));
   this.setForeground(new Color(239, 240, 234));
   this.setTitle("Interface de connexion des clients au serveur de chat");
   jLabel1.setFont(new java.awt.Font("Dialog", 1, 14));
   jLabel1.setText("Adresse du serveur :");
   jLabel1.setBounds(new Rectangle(75, 176, 156, 26));
   jTextField1.setBounds(new Rectangle(230, 176, 108, 25));
   Icon siegle = new ImageIcon(image);
   siegle_L = new JLabel("", siegle, SwingConstants.LEFT);
   siegle_L.setBounds(new Rectangle(0, 1, 76, 105));
   this.getContentPane().add(jLabel1, null);
   this.getContentPane().add(pwd_L, null);
   this.getContentPane().add(Pseudo_L, null);
   this.getContentPane().add(jTextField1, null);
   this.getContentPane().add(nom, null);
   this.getContentPane().add(pwd, null);
   this.getContentPane().add(Bienvenue, null);
   this.getContentPane().add(Connect, null);
   this.getContentPane().add(Annuler, null);
   this.getContentPane().add(siegle_L, null);
   this.setSize(new Dimension(439, 321));
   this.setResizable(false);
   this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   this.setVisible(true);
 }
Exemplo n.º 7
0
  public aboutsw() {
    b1 = new JButton();
    l1 = new JLabel();
    l2 = new JLabel();
    l3 = new JLabel();
    l4 = new JLabel();
    l5 = new JLabel();

    getContentPane().setLayout(null);
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setResizable(false);
    setUndecorated(true);

    getAccessibleContext().setAccessibleName("About");

    b1.setText("Close");
    getContentPane().add(b1);
    b1.setBounds(250, 180, 80, 25);
    b1.addActionListener(new closeListener());

    l1.setFont(new Font("Microsoft Sans Serif", 0, 20));
    l1.setForeground(new java.awt.Color(153, 153, 255));
    l1.setText("Plateform  : ");
    getContentPane().add(l1);
    l1.setBounds(50, 70, 120, 20);

    l2.setText("Gift Sales & Management System");
    l2.setFont(new Font("Century Schoolbook", 1, 16));
    l2.setForeground(new java.awt.Color(255, 51, 51));
    getContentPane().add(l2);
    l2.setBounds(34, 10, 410, 30);

    l3.setForeground(new Color(0, 0, 153));
    l3.setText("Windows 98 / 2000 / XP / Vista / 7");
    getContentPane().add(l3);
    l3.setBounds(100, 95, 200, 20);

    l4.setText("Powered by :");
    l4.setFont(new Font("Microsoft Sans Serif", 0, 18));
    l4.setForeground(new java.awt.Color(153, 153, 255));
    getContentPane().add(l4);
    l4.setBounds(50, 120, 130, 20);

    l5.setText("Amit Kumar Sah");
    l5.setFont(new Font("Microsoft Sans Serif", 0, 18));
    getContentPane().add(l5);
    l5.setBounds(100, 150, 190, 20);
    l5.setForeground(new Color(100, 100, 51));

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    setBounds((screenSize.width - 400) / 2, (screenSize.height - 220) / 2, 450, 240);

    setVisible(true);
  }
Exemplo n.º 8
0
  private void final_scores(Match m) {
    int numPlayers = 0;
    int playerTotal = 0;
    int gameNum = 0, maxGameNum = 0;
    Player p;

    // Create window
    final JFrame f = new JFrame();
    JPanel titles = new JPanel();
    titles.setLayout(new BorderLayout());
    JLabel maintitle = new JLabel("Yahtzee World!");
    maintitle.setFont(new Font("SansSerif", Font.ITALIC, 24));
    JLabel instr = new JLabel("Final Scores (total of game scores).");
    instr.setFont(new Font("SansSerif", Font.PLAIN, 16));
    titles.add(maintitle, "North");
    titles.add(instr, "South");

    JPanel names = new JPanel();
    JLabel l[] = new JLabel[Match.MAXPLAYERS];
    final JTextField t[] = new JTextField[Match.MAXPLAYERS];

    numPlayers = m.getNumPlayers();
    names.setLayout(new GridLayout(numPlayers, 2));
    for (int playerNum = 0; playerNum < numPlayers; playerNum++) {
      p = m.getPlayer(playerNum);
      playerTotal = 0;
      l[playerNum] = new JLabel(p.getName());
      t[playerNum] = new JTextField(20);
      names.add(l[playerNum]);
      names.add(t[playerNum]);
      maxGameNum = (m.getGameNum() >= Match.MAXGAMES) ? (Match.MAXGAMES - 1) : m.getGameNum();
      for (gameNum = 0; gameNum <= maxGameNum; gameNum++) {
        playerTotal += p.getScoreCell(gameNum, CellCodes.GRANDTOTAL);
      }
      t[playerNum].setText(String.valueOf(playerTotal));
    }

    JButton quit = new JButton("Quit");
    quit.addActionListener(
        new ActionListener() {
          // This method is called when the user clicks the JButton
          public void actionPerformed(ActionEvent e) {
            System.exit(0);
          }
        });
    f.add(titles, "North");
    f.add(names, "Center");
    f.add(quit, "South");
    f.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    f.pack();
    f.setVisible(true);
    f.setResizable(false);
  }
  /**
   * Create the pixel location panel
   *
   * @param labelFont the font for the labels
   * @return the location panel
   */
  public JPanel createLocationPanel(Font labelFont) {

    // create a location panel
    JPanel locationPanel = new JPanel();
    locationPanel.setLayout(new FlowLayout());
    Box hBox = Box.createHorizontalBox();

    // create the labels
    rowLabel = new JLabel("Row:");
    colLabel = new JLabel("Column:");

    // create the text fields
    colValue = new JTextField(Integer.toString(colIndex + numberBase), 6);
    colValue.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            displayPixelInformation(colValue.getText(), rowValue.getText());
          }
        });
    rowValue = new JTextField(Integer.toString(rowIndex + numberBase), 6);
    rowValue.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            displayPixelInformation(colValue.getText(), rowValue.getText());
          }
        });

    // set up the next and previous buttons
    setUpNextAndPreviousButtons();

    // set up the font for the labels
    colLabel.setFont(labelFont);
    rowLabel.setFont(labelFont);
    colValue.setFont(labelFont);
    rowValue.setFont(labelFont);

    // add the items to the vertical box and the box to the panel
    hBox.add(Box.createHorizontalGlue());
    hBox.add(rowLabel);
    hBox.add(rowPrevButton);
    hBox.add(rowValue);
    hBox.add(rowNextButton);
    hBox.add(Box.createHorizontalStrut(10));
    hBox.add(colLabel);
    hBox.add(colPrevButton);
    hBox.add(colValue);
    hBox.add(colNextButton);
    locationPanel.add(hBox);
    hBox.add(Box.createHorizontalGlue());

    return locationPanel;
  }
Exemplo n.º 10
0
  /** Set the font used to display today's date as text. */
  protected void setupTodayFont() {
    Font font;
    if (todaysLabel == null) return;

    // If not null, use what the user gave us

    if (todayFont != null) {
      todaysLabel.setFont(todayFont);
    } else {
      font = UIManager.getFont("Label.font");
      todaysLabel.setFont(font);
    }
  }
Exemplo n.º 11
0
 public HeaderPanel(String heading) {
   super();
   this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
   this.setBackground(background);
   JLabel panelLabel = new JLabel(" " + heading, SwingConstants.LEFT);
   Font labelFont = new Font("Dialog", Font.BOLD, 18);
   panelLabel.setFont(labelFont);
   this.add(panelLabel);
   this.add(Box.createHorizontalGlue());
   refresh = new JButton("Refresh");
   refresh.addActionListener(this);
   this.add(refresh);
   this.add(Box.createHorizontalStrut(5));
   root = new JComboBox();
   Dimension d = root.getPreferredSize();
   d.width = 90;
   root.setPreferredSize(d);
   root.setMaximumSize(d);
   File[] roots = directoryPane.getRoots();
   for (int i = 0; i < roots.length; i++) root.addItem(roots[i].getAbsolutePath());
   this.add(root);
   root.setSelectedIndex(directoryPane.getCurrentRootIndex());
   root.addActionListener(this);
   this.add(Box.createHorizontalStrut(17));
 }
  /**
   * Creates the panel that appears when there are no pages
   *
   * @return JPanel
   */
  protected JPanel createFirstPanel() {
    firstButtonPanel = new JPanel(new GridBagLayout());
    firstButtonPanel.setBorder(BorderFactory.createLineBorder(Color.black));
    firstButtonPanel.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent _evt) {
            if (OSPRuntime.isPopupTrigger(_evt))
              return; // SwingUtilities.isRightMouseButton(_evt)) return;
            if (!firstButtonPanel.isEnabled()) return;
            Object obj =
                JOptionPane.showInputDialog(
                    getComponent(),
                    res.getString("TabbedEditor.NewName"),
                    res.getString("TabbedEditor.Rename"),
                    JOptionPane.QUESTION_MESSAGE,
                    null,
                    null,
                    getUniqueName(defaultString));
            if (obj == null) return;
            String txt = obj.toString().trim();
            if (txt.length() > 0) addPage(defaultType, txt, null, true);
            else addPage(defaultType, defaultString, null, true);
          }
        });
    String label = res.getOptionalString("TabbedEditor.ClickHere." + defaultHeader);
    if (label == null) label = res.getString("TabbedEditor.ClickHere");
    firstButton = new JLabel(label);
    firstButton.setFont(firstButton.getFont().deriveFont(TabbedEditor.BUTTON_FONT_SIZE));
    firstButtonPanel.add(firstButton);

    JPanel firstPanel = new JPanel(new GridLayout(0, 1));
    firstPanel.add(firstButtonPanel);
    return firstPanel;
  }
Exemplo n.º 13
0
  public SplitPaneDemo() {

    // Create the list of images and put it in a scroll pane.

    list = new JList(imageNames);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list.setSelectedIndex(0);
    list.addListSelectionListener(this);

    JScrollPane listScrollPane = new JScrollPane(list);
    picture = new JLabel();
    picture.setFont(picture.getFont().deriveFont(Font.ITALIC));
    picture.setHorizontalAlignment(JLabel.CENTER);

    JScrollPane pictureScrollPane = new JScrollPane(picture);

    // Create a split pane with the two scroll panes in it.
    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, listScrollPane, pictureScrollPane);
    splitPane.setOneTouchExpandable(true);
    splitPane.setDividerLocation(150);

    // Provide minimum sizes for the two components in the split pane.
    Dimension minimumSize = new Dimension(100, 50);
    listScrollPane.setMinimumSize(minimumSize);
    pictureScrollPane.setMinimumSize(minimumSize);

    // Provide a preferred size for the split pane.
    splitPane.setPreferredSize(new Dimension(400, 200));
    updateLabel(imageNames[list.getSelectedIndex()]);
  }
Exemplo n.º 14
0
  // -----------------------------------------------------------------
  //  Sets up a panel with a label and a set of radio buttons
  //  that control its text.
  // -----------------------------------------------------------------
  public QuoteOptionsPanel() {
    comedyQuote = "Take my wife, please.";
    philosophyQuote = "I think, therefore I am.";
    carpentryQuote = "Measure twice. Cut once.";

    quote = new JLabel(comedyQuote);
    quote.setFont(new Font("Helvetica", Font.BOLD, 24));
    comedy = new JRadioButton("Comedy", true);
    comedy.setBackground(Color.green);
    philosophy = new JRadioButton("Philosophy");
    philosophy.setBackground(Color.green);
    carpentry = new JRadioButton("Carpentry");
    carpentry.setBackground(Color.green);

    ButtonGroup group = new ButtonGroup();
    group.add(comedy);
    group.add(philosophy);
    group.add(carpentry);

    QuoteListener listener = new QuoteListener();
    comedy.addActionListener(listener);
    philosophy.addActionListener(listener);
    carpentry.addActionListener(listener);

    add(quote);
    add(comedy);
    add(philosophy);
    add(carpentry);

    setBackground(Color.green);
    setPreferredSize(new Dimension(300, 100));
  }
Exemplo n.º 15
0
  public ComboBoxDemo() {
    super(new BorderLayout());

    String[] petStrings = {"Bird", "Cat", "Dog", "Rabbit", "Pig"};

    // Create the combo box, select the item at index 4.
    // Indices start at 0, so 4 specifies the pig.
    JComboBox petList = new JComboBox(petStrings);
    petList.setSelectedIndex(4);
    petList.addActionListener(this);

    // Set up the picture.
    picture = new JLabel();
    picture.setFont(picture.getFont().deriveFont(Font.ITALIC));
    picture.setHorizontalAlignment(JLabel.CENTER);
    updateLabel(petStrings[petList.getSelectedIndex()]);
    picture.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));

    // The preferred size is hard-coded to be the width of the
    // widest image and the height of the tallest image + the border.
    // A real program would compute this.
    picture.setPreferredSize(new Dimension(177, 122 + 10));

    // Lay out the demo.
    add(petList, BorderLayout.PAGE_START);
    add(picture, BorderLayout.PAGE_END);
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
  }
Exemplo n.º 16
0
  public void init() { // a grid to layout the screen nicely
    JLabel title = new JLabel("THE GAME OF NIM!");
    title.setFont(new Font("Times New Roman", Font.PLAIN, 48));
    Panel p = new Panel();
    resize(500, 100);
    // declare a new array of buttons
    a = new JButton[row];
    // initialize each of the buttons in the array
    // with an empty label
    for (int nNum = 0; nNum < row; nNum++) {
      a[nNum] = new JButton("8");
      p.add(a[nNum]);
      // each button will have an action listener
      a[nNum].addActionListener(this);
      a[nNum].setBackground(Color.yellow);
      // each button will send a message with its number
      a[nNum].setActionCommand("" + nNum);
    }

    name = JOptionPane.showInputDialog("Enter name Player 1: ");
    name2 = JOptionPane.showInputDialog("Enter name Player 2:  ");

    JButton reset = new JButton("Reset");
    reset.addActionListener(this);
    reset.setActionCommand("re");

    status = new JLabel("Welcome! The player to remove the final stones is the loser!");
    add(title);
    add(status);
    add(p);
    add(reset);
  }
Exemplo n.º 17
0
  @Override
  public Component getTableCellRendererComponent(
      JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    textLabel.setFont(table.getFont());
    textLabel.setText(Objects.toString(value, ""));
    textLabel.setBorder(hasFocus ? focusCellHighlightBorder : noFocusBorder);

    FontMetrics fm = table.getFontMetrics(table.getFont());
    Insets i = textLabel.getInsets();
    int swidth =
        iconLabel.getPreferredSize().width + fm.stringWidth(textLabel.getText()) + i.left + i.right;
    int cwidth = table.getColumnModel().getColumn(column).getWidth();
    dim.width = swidth > cwidth ? cwidth : swidth;

    if (isSelected) {
      textLabel.setOpaque(true);
      textLabel.setForeground(table.getSelectionForeground());
      textLabel.setBackground(table.getSelectionBackground());
      iconLabel.setIcon(sicon);
    } else {
      textLabel.setOpaque(false);
      textLabel.setForeground(table.getForeground());
      textLabel.setBackground(table.getBackground());
      iconLabel.setIcon(nicon);
    }
    return panel;
  }
Exemplo n.º 18
0
  public TestPanel3() {

    super();

    contentPanel = getContentPanel();
    ImageIcon icon = getImageIcon();

    titlePanel = new javax.swing.JPanel();
    textLabel = new javax.swing.JLabel();
    iconLabel = new javax.swing.JLabel();
    separator = new javax.swing.JSeparator();

    setLayout(new java.awt.BorderLayout());

    titlePanel.setLayout(new java.awt.BorderLayout());
    titlePanel.setBackground(Color.gray);

    textLabel.setBackground(Color.gray);
    textLabel.setFont(new Font("MS Sans Serif", Font.BOLD, 14));
    textLabel.setText("Pretending To Connect To Server");
    textLabel.setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));
    textLabel.setOpaque(true);

    iconLabel.setBackground(Color.gray);
    if (icon != null) iconLabel.setIcon(icon);

    titlePanel.add(textLabel, BorderLayout.CENTER);
    titlePanel.add(iconLabel, BorderLayout.EAST);
    titlePanel.add(separator, BorderLayout.SOUTH);

    add(titlePanel, BorderLayout.NORTH);
    JPanel secondaryPanel = new JPanel();
    secondaryPanel.add(contentPanel, BorderLayout.NORTH);
    add(secondaryPanel, BorderLayout.WEST);
  }
Exemplo n.º 19
0
 public MacRenderer() {
   renderer = new JLabel();
   renderer.setOpaque(Preferences.getBoolean("jeti", "bmw", true));
   renderer.setBackground(UIManager.getColor("Tree.selectionBackground"));
   renderer.setForeground(UIManager.getColor("Tree.textForeground"));
   renderer.setFont(UIManager.getFont("Tree.font"));
 }
Exemplo n.º 20
0
  public TestSwingExample1() {
    super("ActionExample");

    setChannel(currentChannel); // enable/disable the Actions as appropriate

    channelLabel.setHorizontalAlignment(JLabel.CENTER);
    channelLabel.setFont(new Font("Serif", Font.PLAIN, 32));

    getContentPane().add(channelLabel, BorderLayout.NORTH);

    JPanel buttonPanel = new JPanel(new GridLayout(2, 2, 16, 6));
    buttonPanel.setBorder(BorderFactory.createEmptyBorder(6, 16, 16, 16));
    getContentPane().add(buttonPanel, BorderLayout.CENTER);

    buttonPanel.add(new JButton(upAction));
    buttonPanel.add(new JButton(gotoFavoriteAction));
    buttonPanel.add(new JButton(downAction));
    buttonPanel.add(new JButton(setFavoriteAction));

    JMenuBar mb = new JMenuBar();
    JMenu menu = new JMenu("Channel");
    menu.add(new JMenuItem(upAction));
    menu.add(new JMenuItem(downAction));
    menu.addSeparator();
    menu.add(new JMenuItem(gotoFavoriteAction));
    menu.add(new JMenuItem(setFavoriteAction));
    mb.add(menu);
    setJMenuBar(mb);
  }
 private RecentProjectItemRenderer() {
   super(new VerticalFlowLayout());
   setFocusable(true);
   myPath.setFont(myPath.getFont().deriveFont((float) 10));
   add(myName);
   add(myPath);
 }
  /*
   * Gets the user choice for font, style and size and redraws the text
   *     accordingly.
   */
  public void setSampleFont() {
    // Get the font name from the JComboBox
    fontName = (String) facenameCombo.getSelectedItem();

    sampleField.setText(textField.getText());

    // Get the font style from the JCheckBoxes
    fontStyle = 0;
    if (italicCheckBox.isSelected()) fontStyle += Font.ITALIC;
    if (boldCheckBox.isSelected()) fontStyle += Font.BOLD;

    // Get the font size
    fontSize = 0;

    fontSize = Integer.parseInt((String) sizeCombo.getSelectedItem());

    // THE FOLLOWING IS NO LONGER NEEDED
    //            if(smallButton.isSelected())
    //                  fontSize=SMALL;
    //            else if(mediumButton.isSelected())
    //                  fontSize=MEDIUM;
    //            else if(largeButton.isSelected())
    //                  fontSize=LARGE;

    // Set the font of the text field
    sampleField.setFont(new Font(fontName, fontStyle, fontSize));
    sampleField.setForeground(fontColor);
    sampleField.repaint();

    pack();
  } // end setSampleFont method
  // -------------------------------------------------------------------------------------- //
  // ---------------------------------- Constructor Helpers ------------------------------- //
  // -------------------------------------------------------------------------------------- //
  private void buildActiveKits(JPanel container) {
    // initialize variable
    final int WIDTH = 150;

    // set containment panel properties
    container.setLayout(new BoxLayout(container, BoxLayout.Y_AXIS));
    setComponentSize(container, 150, PAGE_HEIGHT);

    JLabel header = new JLabel("Active Kits");
    header.setHorizontalAlignment(header.CENTER);
    header.setFont(new Font("Serif", Font.BOLD, 18));
    setComponentSize(header, WIDTH, 25);

    // create list model and list
    listModel = new DefaultListModel();
    kitList = new JList(listModel);
    kitList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    kitList.addListSelectionListener(this);
    kitList.setFixedCellHeight(25);
    JScrollPane listScrollPane = new JScrollPane(kitList);

    // add elements to containment panel
    container.add(header);
    container.add(listScrollPane);
  }
Exemplo n.º 24
0
  /**
   * Bedingungen und Positionen der Bestandteile
   *
   * @param Title Legt den Titeltext fest
   */
  public Faehigkeiten(String Title) {
    super(Title);

    text =
        new JLabel(
            "                     Manaentzug: 5XP  Lebensentzug: 10XP  Elementarmeister: 15 XP"); // Legt den ersten Text im Label fest
    text.setFont(new Font("Serif", Font.PLAIN, 14)); // Legt Schriftgroesse und Font fest
    getContentPane().add(text);

    nummer1 = new JButton("Manaentzug"); // definiert Position und Größe für die Buttons
    nummer1.setBounds(50, 170, 200, 80);
    nummer1.addActionListener(this);

    nummer2 = new JButton("Elementarmeister"); // definiert Position und Größe für die Buttons
    nummer2.setBounds(190, 400, 200, 80);
    nummer2.addActionListener(this);

    nummer3 = new JButton("Lebensentzug"); // definiert Position und Größe für die Buttons
    nummer3.setBounds(330, 170, 200, 80);
    nummer3.addActionListener(this);

    if (Board.manaleech == false) {
      add(nummer1);
    }
    if (Board.elementarmeister == false) {
      add(nummer2); // fuegt die Buttons und den Text im ersten Label zu
    }
    if (Board.lifeleech == false) {
      add(nummer3);
    }
    add(text);
  }
  // Initializes this component.
  private void jbInit() {
    segmentTable.addFocusListener(
        new FocusListener() {
          public void focusGained(FocusEvent e) {
            segmentTable_focusGained(e);
          }

          public void focusLost(FocusEvent e) {
            segmentTable_focusLost(e);
          }
        });
    segmentTable.setTableHeader(null);
    scrollPane = new JScrollPane(segmentTable);
    scrollPane.setMinimumSize(new Dimension(getTableWidth(), 0));

    setLayout(new BorderLayout(0, 0));

    determineColumnWidth();
    nameLbl.setPreferredSize(new Dimension(getTableWidth(), 25));
    nameLbl.setMinimumSize(new Dimension(getTableWidth(), 0));
    nameLbl.setFont(Utilities.labelsFont);

    segmentTable.setFont(Utilities.valueFont);
    setBorder(BorderFactory.createEtchedBorder());

    setMinimumSize(new Dimension(getTableWidth(), 0));

    this.add(nameLbl, BorderLayout.NORTH);
    this.add(scrollPane, BorderLayout.CENTER);
  }
Exemplo n.º 26
0
  /** Set the title's font. */
  protected void setupTitleFont() {
    Font font;
    if (monthYearLabel == null) return;

    // If not null, use what the user gave us

    if (titleFont != null) {
      monthYearLabel.setFont(titleFont);
    }

    // Otherwise, use the L&F default for a label

    else {
      font = UIManager.getFont("Label.font");
      monthYearLabel.setFont(font);
    }
  }
Exemplo n.º 27
0
 /**
  * Create the name label if needed.
  *
  * @return The component that holds the name label.
  */
 protected JComponent getLabelComponent() {
   if (nameLabel == null) {
     nameLabel = new JLabel();
     Font font = nameLabel.getFont();
     nameLabel.setFont(font.deriveFont(Font.ITALIC | Font.BOLD));
     labelComponent = GuiUtils.hflow(Misc.newList(new JLabel("Layout Model: "), nameLabel));
   }
   return labelComponent;
 }
Exemplo n.º 28
0
  public hostelStatus() {
    setTitle("Hostel");
    connect();
    updateRecord();

    JFrame fr = new JFrame();
    Toolkit tkt = fr.getToolkit();
    Dimension frsize = tkt.getScreenSize();
    setBounds(frsize.width / 4, frsize.height / 12, frsize.width / 2, frsize.height / 8);
    setLayout(null);

    cn = getContentPane();
    cn.setBackground(new Color(190, 180, 170));

    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    tl = new JLabel("Current Hostels Status");
    tl.setFont(new Font("Engravers MT", 1, 25));
    tl.setForeground(new Color(247, 251, 249));

    p1 = new JPanel();
    p1.setBounds(0, 0, 600, 50);
    p1.add(tl);
    p1.setBackground(new Color(31, 88, 166));
    cn.add(p1);

    b1 = new JButton("LOAD");
    b1.setMnemonic('L');
    b1.addActionListener(new dispListener());
    b1.setBounds(230, 320, 120, 30);

    b2 = new JButton("EXIT");
    b2.setMnemonic('X');
    b2.addActionListener(new exitListener());
    b2.setBounds(350, 320, 100, 30);

    cn.add(b1);
    cn.add(b2);

    table = new JTable(data, col);
    table.setFont(new Font("Serif", Font.BOLD, 16));
    table.setBackground(new Color(250, 250, 250));
    table.setEnabled(false);

    JScrollPane jsp = new JScrollPane(table);
    jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    jsp.setBounds(5, 100, 590, 200);
    cn.add(jsp);

    screensize = Toolkit.getDefaultToolkit().getScreenSize();

    setSize(600, 400);
    setVisible(true);
    setVisible(true);
    setResizable(true);
    connect();
  }
Exemplo n.º 29
0
 public StatusPanel(JLabel label) {
   super();
   this.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
   this.setLayout(new FlowLayout(FlowLayout.LEFT));
   this.setBackground(bgColor);
   this.add(new JLabel("Status: "));
   this.add(label);
   label.setFont(new Font("Monospaced", Font.BOLD, 14));
 }
Exemplo n.º 30
0
 public Ammo() {
   // this.setSize(134,480);
   this.setPreferredSize(new Dimension(134, 480));
   try {
     bullet = new ImageIcon("bullet.png");
     grenade = new ImageIcon("grenade.jpg");
     laser = new ImageIcon("laser.jpg");
     shotgun = new ImageIcon("shotgun.jpg");
   } catch (Exception e) {
   }
   l.setBounds(40, 0, 100, 30);
   l.setFont(new Font("Serif", Font.BOLD, 14));
   l.setForeground(Color.yellow);
   s.setBounds(90, 0, 100, 30);
   s.setFont(new Font("Serif", Font.BOLD, 14));
   s.setForeground(Color.yellow);
   increase.start();
 }