public JPanel createContentPane() {

    // We create a bottom JPanel to place everything on.
    JPanel totalGUI = new JPanel();

    // We set the layout of the main JPanel to be BoxLayout.
    // LINE_AXIS sets them left to right, PAGE_AXIS sets them
    // from top to bottom.
    totalGUI.setLayout(new BoxLayout(totalGUI, BoxLayout.LINE_AXIS));

    JPanel redPanel = new JPanel();
    redPanel.setBackground(Color.red);
    redPanel.setMinimumSize(new Dimension(50, 50));
    redPanel.setPreferredSize(new Dimension(50, 50));
    totalGUI.add(redPanel);

    // This is the first spacer. This creates a spacer 10px wide that
    // will never get bigger or smaller.
    totalGUI.add(Box.createRigidArea(new Dimension(10, 0)));

    JPanel yellowPanel = new JPanel();
    yellowPanel.setBackground(Color.yellow);
    yellowPanel.setPreferredSize(new Dimension(50, 50));
    totalGUI.add(yellowPanel);

    // This spacer takes any spare space and places it as part of the spacer
    // If you drag the window wider, the space will get wider.
    totalGUI.add(Box.createHorizontalGlue());

    JPanel greenPanel = new JPanel();
    greenPanel.setBackground(Color.green);
    greenPanel.setPreferredSize(new Dimension(50, 50));
    totalGUI.add(greenPanel);

    // This spacer is a custom spacer.
    // The minimum size acts like a rigid area that
    // will not get any smaller than 10 pixels on the x-axis (horizontal)
    // and not get any smaller than 50 pixels on the y axis (vertical).
    // The way the maximum size is set up means the spacer acts like glue
    // and will expand to fit the available space.

    Dimension minSize = new Dimension(10, 50);
    Dimension prefSize = new Dimension(10, 50);
    Dimension maxSize = new Dimension(Short.MAX_VALUE, 50);
    totalGUI.add(new Box.Filler(minSize, prefSize, maxSize));

    JPanel bluePanel = new JPanel();
    bluePanel.setBackground(Color.blue);
    bluePanel.setPreferredSize(new Dimension(50, 50));
    totalGUI.add(bluePanel);

    totalGUI.setOpaque(true);
    return totalGUI;
  }
예제 #2
0
  public static void main(String[] args) {
    JFrame frame = new JFrame("Demo of Additional Borders");
    frame.setIconImage(JideIconsFactory.getImageIcon(JideIconsFactory.JIDE32).getImage());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(new BorderLayout());

    JPanel panel = new JPanel();
    panel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
    panel.setLayout(new JideBoxLayout(panel, JideBoxLayout.Y_AXIS, 10));

    JTextArea textField = new JTextArea();
    JPanel border = new JPanel(new BorderLayout());
    border.setPreferredSize(new Dimension(100, 100));
    border.add(new JScrollPane(textField), BorderLayout.CENTER);
    border.setBorder(
        new JideTitledBorder(
            new PartialEtchedBorder(PartialEtchedBorder.LOWERED, PartialSide.NORTH),
            "PartialEtchedBorder"));

    JTextArea textField2 = new JTextArea();
    JPanel border2 = new JPanel(new BorderLayout());
    border2.setPreferredSize(new Dimension(100, 100));
    border2.add(new JScrollPane(textField2), BorderLayout.CENTER);
    border2.setBorder(
        new JideTitledBorder(
            new PartialLineBorder(Color.darkGray, 1, PartialSide.NORTH), "PartialLineBorder"));

    JTextArea textField3 = new JTextArea();
    JPanel border3 = new JPanel(new BorderLayout());
    border3.setPreferredSize(new Dimension(100, 100));
    border3.add(new JScrollPane(textField3), BorderLayout.CENTER);
    border3.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(
                new PartialLineBorder(Color.gray, 1, true), "Rounded Corners Border"),
            BorderFactory.createEmptyBorder(0, 6, 4, 6)));

    panel.add(border, JideBoxLayout.FLEXIBLE);
    panel.add(Box.createVerticalStrut(12));
    panel.add(border2, JideBoxLayout.FLEXIBLE);
    panel.add(Box.createVerticalStrut(12));
    panel.add(border3, JideBoxLayout.FLEXIBLE);
    panel.add(Box.createGlue(), JideBoxLayout.VARY);

    panel.setPreferredSize(new Dimension(500, 400));
    frame.getContentPane().add(panel, BorderLayout.CENTER);
    frame.pack();
    frame.setVisible(true);
  }
  HeatMapControls(ControlBar creator) {
    super();
    parent = creator;

    setLayout(new BorderLayout());
    super.setPreferredSize(new Dimension(255, 170));

    String[] organisms = SpeciesTable.getOrganisms();
    String[] options = new String[organisms.length + 1];

    options[0] = "None";
    for (int i = 0; i < organisms.length; i++) {
      options[i + 1] = organisms[i];
    }

    species = new JComboBox(options);
    species.addActionListener(this);
    for (String str : SpeciesTable.getOrganisms()) {}

    super.add(species, BorderLayout.SOUTH);
    super.add(new Gradient(), BorderLayout.CENTER);
    super.add(new JLabel("Least"), BorderLayout.WEST);
    super.add(new JLabel("Most"), BorderLayout.EAST);
    super.add(new JLabel("Heat Map Controls"), BorderLayout.NORTH);
    super.setVisible(true);
  }
예제 #4
0
  private JPanel makeButtonPanel() {

    JPanel p = new JPanel();
    p.setLayout(new GridLayout(5, 1));
    p.setPreferredSize(new Dimension(150, 160));

    JLabel translationLabel = new JLabel("Set Translation (nm)", JLabel.CENTER);
    p.add(translationLabel);

    JLabel[] label =
        new JLabel[] {
          new JLabel("dx: ", JLabel.RIGHT),
          new JLabel("dy: ", JLabel.RIGHT),
          new JLabel("dz: ", JLabel.RIGHT)
        };

    JPanel[] shiftPanel = new JPanel[3];
    for (int i = 0; i < 3; i++) {
      shiftPanel[i] = new JPanel();
      shiftPanel[i].add(label[i]);
      shiftTF[i] =
          new ValueTextField("0.0", 5, ValueTextField.DOUBLE, Constraints.NO_CONSTRAINT, false);
      shiftPanel[i].add(shiftTF[i]);
      p.add(shiftPanel[i]);
    }

    JPanel buttonPanel = new JPanel();
    shift = new JButton("Translate");
    buttonPanel.add(shift);
    p.add(buttonPanel);

    JPanel rPanel = new JPanel();
    rPanel.add(p);
    return rPanel;
  }
예제 #5
0
  private JPanel getMainPanel() {
    if (mainPanel == null) {
      mainPanel = new JPanel();
      mainPanel.setPreferredSize(new Dimension(550, 300));
      GridBagLayout layout = new GridBagLayout();

      mainPanel.setLayout(layout);

      GridBagConstraints constraints = new GridBagConstraints();

      constraints.fill = GridBagConstraints.BOTH;
      constraints.weightx = 2;
      constraints.weighty = 1;
      constraints.anchor = GridBagConstraints.NORTHWEST;
      constraints.gridwidth = 2;
      layout.setConstraints(getAvailableRobotsPanel(), constraints);
      mainPanel.add(getAvailableRobotsPanel());
      constraints.gridwidth = 1;
      constraints.weightx = 0;
      constraints.weighty = 0;
      constraints.anchor = GridBagConstraints.CENTER;
      layout.setConstraints(getButtonsPanel(), constraints);
      mainPanel.add(getButtonsPanel());
      constraints.gridwidth = GridBagConstraints.REMAINDER;
      constraints.weightx = 1;
      constraints.weighty = 1;
      constraints.anchor = GridBagConstraints.NORTHWEST;
      layout.setConstraints(getSelectedRobotsPanel(), constraints);
      mainPanel.add(getSelectedRobotsPanel());
    }
    return mainPanel;
  }
  public static void main(String[] args) {
    int i = 3; // Default to 3
    if (args.length >= 1) {
      try {
        i = Integer.parseInt(args[0]);
      } catch (NumberFormatException e) {
        System.out.println("Usage: 'java SierpinskyTriangle [level]'\nNow setting level to " + i);
      }
    }
    final int level = i;

    JFrame frame = new JFrame("Sierpinsky Triangle - Java");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JPanel panel =
        new JPanel() {
          @Override
          public void paintComponent(Graphics g) {
            g.setColor(Color.BLACK);
            drawSierpinskyTriangle(level, 20, 20, 360, (Graphics2D) g);
          }
        };

    panel.setPreferredSize(new Dimension(400, 400));

    frame.add(panel);
    frame.pack();
    frame.setResizable(false);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  }
예제 #7
0
  public JPanel bookpanel() {
    JPanel inner = new JPanel();
    inner.setLayout(new BoxLayout(inner, BoxLayout.Y_AXIS));

    JLabel title = new JLabel("Book:");
    title.setFont(titleFont);
    inner.add(title);

    // Add a panel as a spacer
    JPanel spacer = new JPanel();
    spacer.setPreferredSize(new Dimension(400, 1));
    spacer.setBackground(Color.black);
    inner.add(spacer);

    JLabel Clabel_1 = new JLabel("Enter author details:");
    Clabel_1.setFont(mainFont);
    inner.add(Clabel_1);
    JTextField Ctextfield_1 = new JTextField(20);
    Ctextfield_1.setText(this.auto_book_author);
    inner.add(Ctextfield_1);

    JLabel Clabel_2 = new JLabel("Enter title of publication:");
    Clabel_2.setFont(mainFont);
    inner.add(Clabel_2);
    JTextField Ctextfield_2 = new JTextField(20);
    Ctextfield_2.setText(this.auto_book_title);
    inner.add(Ctextfield_2);

    JLabel Clabel_3 = new JLabel("Enter date of publication:");
    Clabel_3.setFont(mainFont);
    inner.add(Clabel_3);
    JTextField Ctextfield_3 = new JTextField(20);
    Ctextfield_3.setText(this.auto_book_date);
    inner.add(Ctextfield_3);

    JLabel Clabel_4 = new JLabel("Enter publisher:");
    Clabel_4.setFont(mainFont);
    inner.add(Clabel_4);
    JTextField Ctextfield_4 = new JTextField(20);
    Ctextfield_4.setText(this.auto_book_publisher);
    inner.add(Ctextfield_4);

    JLabel Clabel_5 = new JLabel("Enter place of publication:");
    Clabel_5.setFont(mainFont);
    inner.add(Clabel_5);
    JTextField Ctextfield_5 = new JTextField(20);
    inner.add(Ctextfield_5);

    JButton Cbutton = new JButton("Create reference");
    inner.add(Cbutton);

    Cbutton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            System.out.println(Ctextfield_1.getText() + " is the author");
            Ctextfield_5.setText(Ctextfield_1.getText() + "\"" + Ctextfield_4.getText() + "\"");
          }
        });
    return inner;
  }
예제 #8
0
  public JPanel createLaneTrafficGenerator(
      Route in, RouteAspect aspect, Engine engine, RouteAspect routes) {
    JPanel controller = vertical();
    TrafficGenerator generator = new TrafficGenerator(in, engine, routes);
    aspect.addTrafficGenerator(generator);
    IntTextField imprecision = new IntTextField();
    IntTextField traffic = new IntTextField();
    JLabel message = new JLabel();
    generator.configure(0, DEFAULT_TRAFFIC_PER_HOUR);
    imprecision.setText("" + 0);
    traffic.setText("" + DEFAULT_TRAFFIC_PER_HOUR);

    JButton validate =
        new JButton("Valider") {
          public TrafficGenerator holder = generator;
        };

    validate.addActionListener(
        (e) -> {
          int imp = imprecision.getValue();
          int traf = traffic.getValue();
          if (traf < 0) traf = 0;
          if (imp < 0) imp = 0;
          if (imp > 100) imp = 100;
          generator.configure(imp, traf);
          message.setText("Modifcation prise en compte");
        });

    controller.add(horizontal(new JLabel("Imprecision (+/-)      "), imprecision));
    controller.add(horizontal(new JLabel("Densite (voiture/heure)"), traffic));
    controller.add(horizontal(validate, message));
    controller.setPreferredSize(new Dimension(100, 100));
    controller.setSize(100, 100);
    return controller;
  }
예제 #9
0
  /** Description of the Method */
  public void init() {
    // super.init();
    size = new Dimension(570, 570);
    contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(borderLayout1);

    Dimension d = messagePanel.getSize();
    d.height += 20;
    messagePanel.setPreferredSize(d);
    contentPane.add(messagePanel, BorderLayout.SOUTH);

    contentPane.setOpaque(true);
    userPanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(2, 2, 2, 2);

    messagePanel.setLayout(borderLayout5);
    contentPane.setOpaque(true);
    contentPane.setBackground(Color.white);
    this.setSize(size);

    messagePanel.add(labelMessage, BorderLayout.NORTH);
    // Logg.logg("MhClient: Före XttTree-skapande", 6);
    this.mhTable = new MhTable(root, false, this.labelMessage);
    // Logg.logg("MhClient: mhTable-skapande klart", 6);
    this.contentPane.add(this.mhTable.splitPane, BorderLayout.CENTER);
  }
예제 #10
0
  public ContactListUI() {
    cList = new ContactList("contacts.txt");

    // Set up the To: and From: panel
    JPanel staticPanel = new JPanel();
    staticPanel.setPreferredSize(new Dimension(100, 100));
    staticPanel.setLayout(new GridLayout(3, 1));
    to = new JButton("To: ");
    staticPanel.add(to);
    staticPanel.add(new JLabel(" "));
    staticPanel.add(new JLabel("From:", JLabel.CENTER));

    // Set up the panel for addContacts and removeContacts;
    JPanel buttonPanel = new JPanel();
    addContacts = new JButton("Add");
    removeContacts = new JButton("Remove");
    editContacts = new JButton("Edit");
    buttonPanel.setLayout(new FlowLayout());
    buttonPanel.add(addContacts);
    buttonPanel.add(removeContacts);
    buttonPanel.add(editContacts);

    // Set up the panel with the contact selection and buttons
    JPanel dynPanel = new JPanel();
    toText = new JTextField();
    fromText = new JTextField();
    dynPanel.setPreferredSize(new Dimension(300, 100));
    dynPanel.setLayout(new GridLayout(3, 1));
    dynPanel.add(toText);
    dynPanel.add(buttonPanel);
    dynPanel.add(fromText);

    // Add everything to a ContactUI
    to.addActionListener(this);
    addContacts.addActionListener(this);
    removeContacts.addActionListener(this);
    editContacts.addActionListener(this);
    this.setPreferredSize(new Dimension(500, 125));
    this.setLayout(new FlowLayout());
    this.add(staticPanel);
    this.add(dynPanel);

    deleteContact = new JButton("Delete");
    deleteContact.addActionListener(this);
    addSendContacts = new JButton("Confirm");
    addSendContacts.addActionListener(this);
  }
예제 #11
0
  // Initialize all the GUI components and display the frame
  private static void initGUI() {
    // Set up the status bar
    statusField = new JLabel();
    statusField.setText(statusMessages[DISCONNECTED]);
    statusColor = new JTextField(1);
    statusColor.setBackground(Color.red);
    statusColor.setEditable(false);
    statusBar = new JPanel(new BorderLayout());
    statusBar.add(statusColor, BorderLayout.WEST);
    statusBar.add(statusField, BorderLayout.CENTER);

    // Set up the options pane
    JPanel optionsPane = initOptionsPane();

    // Set up the chat pane
    JPanel chatPane = new JPanel(new BorderLayout());
    chatText = new JTextArea(10, 20);
    chatText.setLineWrap(true);
    chatText.setEditable(false);
    chatText.setForeground(Color.blue);
    JScrollPane chatTextPane =
        new JScrollPane(
            chatText,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    chatLine = new JTextField();
    chatLine.setEnabled(false);
    chatLine.addActionListener(
        new ActionAdapter() {
          public void actionPerformed(ActionEvent e) {
            String s = chatLine.getText();
            if (!s.equals("")) {
              appendToChatBox("OUTGOING: " + s + "\n");
              chatLine.selectAll();

              // Send the string
              sendString(s);
            }
          }
        });
    chatPane.add(chatLine, BorderLayout.SOUTH);
    chatPane.add(chatTextPane, BorderLayout.CENTER);
    chatPane.setPreferredSize(new Dimension(200, 200));

    // Set up the main pane
    JPanel mainPane = new JPanel(new BorderLayout());
    mainPane.add(statusBar, BorderLayout.SOUTH);
    mainPane.add(optionsPane, BorderLayout.WEST);
    mainPane.add(chatPane, BorderLayout.CENTER);

    // Set up the main frame
    mainFrame = new JFrame("Simple TCP Chat");
    mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    mainFrame.setContentPane(mainPane);
    mainFrame.setSize(mainFrame.getPreferredSize());
    mainFrame.setLocation(200, 200);
    mainFrame.pack();
    mainFrame.setVisible(true);
  }
예제 #12
0
  /**
   * Loads the tileset defined in the constructor into a JPanel which it then returns. Makes no
   * assumptions about height or width, which means it needs to read an extra 64 tiles at worst (32
   * down to check height and 32 across for width), since the maximum height/width is 32 tiles.
   */
  public JPanel loadTileset() {
    int height = MAX_TILESET_SIZE;
    int width = MAX_TILESET_SIZE;

    boolean maxHeight = false;
    boolean maxWidth = false;

    // find width
    int j = 0;
    while (!maxWidth) {
      try {
        File f = new File(tileDir + "/" + j + "_" + 0 + ".png");
        ImageIO.read(f);
      } catch (IOException e) {
        width = j;
        maxWidth = true;
      }
      j += TILE_SIZE;
    }

    // find height
    int i = 0;
    while (!maxHeight) {
      try {
        File f = new File(tileDir + "/" + 0 + "_" + i + ".png");
        ImageIO.read(f);
      } catch (IOException e) {
        height = i;
        maxHeight = true;
      }
      i += TILE_SIZE;
    }

    JPanel tileDisplay = new JPanel();
    tileDisplay.setLayout(new GridLayout(height / TILE_SIZE, width / TILE_SIZE));
    tileDisplay.setMinimumSize(new Dimension(width, height));
    tileDisplay.setPreferredSize(new Dimension(width, height));
    tileDisplay.setMaximumSize(new Dimension(width, height));

    for (i = 0; i < height; i += TILE_SIZE) {
      for (j = 0; j < width; j += TILE_SIZE) {
        String fPath = tileDir + "/" + j + "_" + i;
        try {
          int[] mov = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};

          Image icon = getTile(tileDir, j, i, 1);
          Tile tile =
              new Tile(new ImageIcon(icon), "palette", 0, 0, mov, "none", false, "" + j + "_" + i);
          tile.addMouseListener(new PaletteButtonListener());
          tile.setMaximumSize(new Dimension(TILE_SIZE, TILE_SIZE));
          tile.setPreferredSize(new Dimension(TILE_SIZE, TILE_SIZE));
          tile.setMinimumSize(new Dimension(TILE_SIZE, TILE_SIZE));
          tileDisplay.add(tile);
        } catch (IOException e) {
        }
      }
    }
    return tileDisplay;
  }
 private void syncSizeToCertificateDetail() {
   if (usermessage != null) {
     usermessage.setPreferredSize(cd.getPreferredSize());
     usermessage.setMinimumSize(cd.getMinimumSize());
   }
   detailPane.setPreferredSize(cd.getPreferredSize());
   detailPane.setMinimumSize(cd.getMinimumSize());
 }
예제 #14
0
  @Override
  protected JComponent createCenterPanel() {
    final JPanel panel = new JPanel(new BorderLayout());
    JTextArea area =
        new JTextArea(
            "The imported language extends other languages.\n"
                + "It might be useful to import all or some of them.");
    area.setEditable(false);
    area.setBackground(this.getContentPane().getBackground());
    area.setBorder(BorderFactory.createEmptyBorder(5, 5, 3, 5));
    panel.add(area, BorderLayout.NORTH);

    JPanel center = new JPanel(new GridBagLayout());
    JTextArea label = new JTextArea("Select additional languages to import:");
    label.setEditable(false);
    label.setBackground(getContentPane().getBackground());
    label.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    center.add(
        label,
        new GridBagConstraints(
            0,
            GridBagConstraints.RELATIVE,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0),
            0,
            0));

    myList = new JBList(myCandidates.toArray());

    myList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    myList.setSelectionInterval(0, myList.getModel().getSize() - 1);
    myList.setCellRenderer(new MyDefaultListCellRenderer());
    myList.setBorder(BorderFactory.createEtchedBorder());
    center.add(
        ScrollPaneFactory.createScrollPane(myList),
        new GridBagConstraints(
            0,
            GridBagConstraints.RELATIVE,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));

    panel.add(center, BorderLayout.CENTER);
    panel.setPreferredSize(new Dimension(400, 250));

    return panel;
  }
 @Nullable
 @Override
 protected JComponent createCenterPanel() {
   JPanel panel = new JPanel(new BorderLayout());
   panel.add(createNamePanel(), BorderLayout.CENTER);
   if (myOccurrencesCount > 1) panel.add(createReplaceAllPanel(), BorderLayout.SOUTH);
   panel.setPreferredSize(new Dimension(myNameField.getWidth(), -1));
   return panel;
 }
예제 #16
0
  public void createPanel3() {
    panel3 = new JPanel();
    panel3.setLayout(new BorderLayout());
    panel3.setPreferredSize(new Dimension(400, 100));
    panel3.setMinimumSize(new Dimension(100, 50));

    panel3.add(new JLabel("Notes:"), BorderLayout.NORTH);
    panel3.add(new JTextArea(), BorderLayout.CENTER);
  }
예제 #17
0
  public void addPanel(String name, JPanel panel) {

    if (tabbedPane.getTabCount() == 0) {
      preffered = panel.getPreferredSize();
    }

    panel.setPreferredSize(preffered);
    tabbedPane.add(name, panel);
  }
예제 #18
0
  /** Creates an instance of the <tt>AdvancedConfigurationPanel</tt>. */
  public AdvancedConfigurationPanel() {
    super(new BorderLayout(10, 0));

    initList();

    centerPanel.setPreferredSize(new Dimension(500, 500));

    add(centerPanel, BorderLayout.CENTER);
  }
예제 #19
0
  public UnitTestRunner() {
    mainPane = new JPanel(new GridBagLayout());
    mainPane.setMinimumSize(new Dimension(0, 0));
    mainPane.setPreferredSize(new Dimension(270, 200));
    minPane = new JPanel(new GridBagLayout());

    initComponents();

    addGrid(
        mainPane, toolbar, 0, 0, 2, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST);

    addGrid(
        mainPane,
        new JSeparator(),
        0,
        1,
        2,
        GridBagConstraints.HORIZONTAL,
        1.0,
        GridBagConstraints.WEST);

    addGrid(
        mainPane, fCounterPanel, 0, 2, 2, GridBagConstraints.NONE, 0.0, GridBagConstraints.WEST);
    addGrid(
        mainPane,
        fProgressIndicator,
        0,
        3,
        2,
        GridBagConstraints.HORIZONTAL,
        1.0,
        GridBagConstraints.WEST);

    addGrid(
        mainPane,
        new JSeparator(),
        0,
        5,
        2,
        GridBagConstraints.HORIZONTAL,
        1.0,
        GridBagConstraints.WEST);
    addGrid(
        mainPane,
        new JLabel("Results:"),
        0,
        6,
        2,
        GridBagConstraints.HORIZONTAL,
        1.0,
        GridBagConstraints.WEST);

    addGrid(mainPane, fTestViewTab, 0, 7, 2, GridBagConstraints.BOTH, 1.0, GridBagConstraints.WEST);

    // _lineNoOfTest = new HashMap<String, Integer>();
  }
예제 #20
0
  /** methode creatWidget dimmensionne panelConnect et panelInit */
  public void createWidget() {

    panConn = createPanelConnect();
    panConn.setSize(new Dimension(350, 100));
    panInit = createPanelInit();
    panInit.setPreferredSize(new Dimension(1200, 300));
    panParty = createPanelPlay();

    setContentPane(panConn);
  }
예제 #21
0
 /*Creates the South section of the mancala board. */
 private JPanel southBoardPanel() {
   JPanel southPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 300, 50));
   p1Label = new JLabel("Player 1");
   p1Label.setFont(new Font("Belta Regular", Font.BOLD, 50));
   p1Label.setForeground(new Color(203, 159, 0));
   southPanel.add(p1Label);
   southPanel.setOpaque(false);
   southPanel.setPreferredSize(new Dimension(600, 100));
   return southPanel;
 }
예제 #22
0
  public ColorRenderer() {
    panel = new JPanel();
    panel.setLayout(new BorderLayout());
    renderer = new JLabel();

    colourPanel = new javax.swing.JPanel();
    renderer = new javax.swing.JLabel();
    blank2 = new javax.swing.JPanel();
    blank1 = new javax.swing.JPanel();

    panel.add(renderer, BorderLayout.CENTER);
    blank2.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));
    blank2.setPreferredSize(new Dimension(20, 2));

    colourPanel.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, false));
    colourPanel.setPreferredSize(new Dimension(12, 12));

    blank2.add(colourPanel);
    panel.add(blank2, BorderLayout.WEST);
  }
예제 #23
0
 private JPanel getSelectedRobotsPanel() {
   if (selectedRobotsPanel == null) {
     selectedRobotsPanel = new JPanel();
     selectedRobotsPanel.setLayout(new BorderLayout());
     selectedRobotsPanel.setPreferredSize(new Dimension(120, 100));
     selectedRobotsPanel.setBorder(
         BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Selected Robots"));
     selectedRobotsPanel.add(getSelectedRobotsScrollPane(), BorderLayout.CENTER);
   }
   return selectedRobotsPanel;
 }
  private void createPropertiesPanel() {
    myPropertiesPanel = new JPanel(new BorderLayout());
    final JPanel emptyPanel = new JPanel();
    emptyPanel.setMinimumSize(JBUI.emptySize());
    emptyPanel.setPreferredSize(JBUI.emptySize());

    myPropertiesPanelWrapper = new JPanel(new CardLayout());
    myPropertiesPanel.setBorder(new CustomLineBorder(1, 0, 0, 0));
    myPropertiesPanelWrapper.add(EMPTY_CARD, emptyPanel);
    myPropertiesPanelWrapper.add(PROPERTIES_CARD, myPropertiesPanel);
  }
예제 #25
0
  public DatePicker(JFrame parent) {
    d = new JDialog();
    d.setModal(true);
    String[] header = {"Sun", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat"};
    JPanel p1 = new JPanel(new GridLayout(7, 7));
    p1.setPreferredSize(new Dimension(430, 120));

    for (int x = 0; x < button.length; x++) {
      final int selection = x;
      button[x] = new JButton();
      button[x].setFocusPainted(false);
      button[x].setBackground(Color.white);
      if (x > 6)
        button[x].addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent ae) {
                day = button[selection].getActionCommand();
                d.dispose();
              }
            });
      if (x < 7) {
        button[x].setText(header[x]);
        button[x].setForeground(Color.red);
      }
      p1.add(button[x]);
    }
    JPanel p2 = new JPanel(new GridLayout(1, 3));
    JButton previous = new JButton("<< Previous");
    previous.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            month--;
            displayDate();
          }
        });
    p2.add(previous);
    p2.add(l);
    JButton next = new JButton("Next >>");
    next.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            month++;
            displayDate();
          }
        });
    p2.add(next);
    d.add(p1, BorderLayout.CENTER);
    d.add(p2, BorderLayout.SOUTH);
    d.pack();
    d.setLocationRelativeTo(parent);
    displayDate();
    d.setVisible(true);
  }
예제 #26
0
  /*Creates the East section of the mancala board. Contains Collection Pit*/
  private JPanel eastBoardPanel() {
    JPanel eastPanel = new JPanel();
    eastPanel.setOpaque(false);
    eastPanel.setPreferredSize(new Dimension(150, 600));

    b6 = new JButton(String.valueOf(game.board.getPitAt(6).getCount()));
    b6.setPreferredSize(new Dimension(100, 330));
    b6.setFont(new Font("Belta Regular", Font.BOLD, 32));
    b6.setBackground(new Color(214, 162, 173));
    eastPanel.add(b6);
    return eastPanel;
  }
예제 #27
0
  public void init() {
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));

    JLabel nameLabel = new JLabel(getFieldName());
    valueField = new JPanel();
    valueField.setPreferredSize(new Dimension(10, 10));

    add(valueField);
    add(nameLabel);
    revalidate();
    repaint();
  }
예제 #28
0
  // Panel above board
  private JPanel northWindowPanel() {
    JPanel lab2Panel = new JPanel();
    lab2Panel.setLayout(new BorderLayout());
    lab2Panel.setPreferredSize(new Dimension(300, 150));
    lab2Panel.setOpaque(false);
    statusLabel2 = new JLabel("", JLabel.CENTER);
    statusLabel2.setForeground(new Color(203, 159, 0));
    statusLabel2.setFont(new Font("Belta Regular", Font.ITALIC, 45));

    lab2Panel.add(statusLabel2, BorderLayout.CENTER);
    return lab2Panel;
  }
예제 #29
0
  // Panel below board (Contains Label Indicating Player 1's turn
  private JPanel southWindowPanel() {
    JPanel lab1Panel = new JPanel();
    lab1Panel.setLayout(new BorderLayout());
    lab1Panel.setPreferredSize(new Dimension(300, 150));
    lab1Panel.setOpaque(false);
    statusLabel1 = new JLabel("Player 1's Turn", JLabel.CENTER);
    statusLabel1.setForeground(new Color(203, 159, 0));
    statusLabel1.setFont(new Font("Belta Regular", Font.ITALIC, 45));

    lab1Panel.add(statusLabel1, BorderLayout.CENTER);

    JPanel eastContainer = new JPanel();
    eastContainer.setLayout(new BorderLayout());
    eastContainer.setOpaque(false);
    eastContainer.setPreferredSize(new Dimension(200, 300));

    JPanel btnPanel = new JPanel();
    btnPanel.setOpaque(false);
    btnPanel.setPreferredSize(new Dimension(300, 60));
    eastContainer.add(btnPanel, BorderLayout.SOUTH);

    // Add help button to panel
    instructBtn.setPreferredSize(new Dimension(50, 40));
    instructBtn.setBorder(BorderFactory.createLineBorder(Color.black, 5));
    instructBtn.addActionListener(new ButtonListener());
    btnPanel.add(instructBtn);

    // Add restart button to panel
    restartBtn.setPreferredSize(new Dimension(100, 40));
    restartBtn.setBorder(BorderFactory.createLineBorder(Color.black, 5));
    restartBtn.addActionListener(new ButtonListener()); // Add Action Listener (Reset Game)
    btnPanel.add(restartBtn);

    JPanel westContainer = new JPanel();
    westContainer.setPreferredSize(new Dimension(200, 300));
    westContainer.setOpaque(false);
    lab1Panel.add(westContainer, BorderLayout.WEST);
    lab1Panel.add(eastContainer, BorderLayout.EAST);
    return lab1Panel;
  }
예제 #30
0
  public void createviewPanel() {

    viewPanel = new JPanel();
    viewPanel.setLayout(new BorderLayout());
    // viewPanel.setPreferredSize( new Dimension(500,500 ));
    // viewPanel.setMinimumSize( new Dimension(100,50));
    // viewPanel.add( new JLabel("Notes:"),BorderLayout.NORTH );
    //		viewPanel.add( new JTextArea(), BorderLayout.CENTER );
    viewPanel.setPreferredSize(new Dimension(200, 520));
    viewPanel.setMinimumSize(new Dimension(100, 100));
    // Create columns
    CreateColumns(colcnt);
    CreateData(rowcnt, colcnt);
    setSize(300, 200);

    table =
        new JTable(dataValues, columnNames) {

          public boolean isCellEditable(int rowIndex, int vColIndex) {
            return false;
          }
        };

    table
        .getModel()
        .addTableModelListener(
            new TableModelListener() {

              public void tableChanged(TableModelEvent e) {
                System.out.println("........" + e);
              }
            });
    // table.setValueAt("1,2",0,0);

    System.out.println("Row   :" + rowcnt);
    System.out.println("Col  :" + colcnt);

    // Configure some of JTable's paramters
    table.setShowHorizontalLines(false);
    table.setShowVerticalLines(false);
    table.setRowSelectionAllowed(false);
    table.setColumnSelectionAllowed(false);

    // Change the selection colour
    table.setSelectionForeground(Color.white);
    table.setSelectionBackground(Color.red);

    // Add the table to a scrolling pane
    scrollPaneTable = JTable.createScrollPaneForTable(table);
    viewPanel.add(scrollPaneTable, BorderLayout.CENTER);
    viewPanel.add(table, BorderLayout.CENTER);
  }