Esempio n. 1
0
  /**
   * Tests the combination of a default size spec with an upper bound that shall ensure a maximum
   * size.
   */
  public void testDefaultWithUpperBound() {
    TestComponent c1 = new TestComponent(10, 10, 50, 50);
    FormLayout layout = new FormLayout("[default,20px]", "[default,20px]");

    JPanel panel = new JPanel(layout);
    panel.add(c1, cc.xy(1, 1));

    Dimension minimumLayoutSize = layout.minimumLayoutSize(panel);
    Dimension preferredLayoutSize = layout.preferredLayoutSize(panel);

    assertEquals("Minimum layout width", 10, minimumLayoutSize.width);
    assertEquals("Minimum layout height", 10, minimumLayoutSize.height);
    assertEquals("Preferred layout width", 20, preferredLayoutSize.width);
    assertEquals("Preferred layout height", 20, preferredLayoutSize.height);

    panel.setSize(minimumLayoutSize);
    panel.doLayout();
    int columnWidth = c1.getWidth();
    int rowHeight = c1.getHeight();
    assertEquals("Column width (container min)", 10, columnWidth);
    assertEquals("Row height (container min)", 10, rowHeight);

    panel.setSize(preferredLayoutSize);
    panel.doLayout();
    columnWidth = c1.getWidth();
    rowHeight = c1.getHeight();
    assertEquals("Column width (container pref)", 20, columnWidth);
    assertEquals("Row height (container pref)", 20, rowHeight);
  }
Esempio n. 2
0
  public MainFrame() {
    Service.createAndStoreSomeObjects();
    pnlContent = (JPanel) this.getContentPane();
    pnlContent.setLayout(null);

    pnlScreen = new JPanel();
    pnlContent.add(pnlScreen);
    pnlScreen.setSize(300, 380);
    pnlScreen.setLocation(10, 10);
    pnlScreen.setLayout(null);

    pnlButtons = new JPanel();
    pnlContent.add(pnlButtons);
    pnlButtons.setSize(300, 60);
    pnlButtons.setLocation(10, 400);
    pnlButtons.setLayout(null);

    btnHome = new JButton("Home");
    pnlButtons.add(btnHome);
    btnHome.setSize(70, 30);
    btnHome.setLocation(115, 10);
    btnHome.addActionListener(controller);

    // ---------------------------------------------------------------------

    Color color = new Color(99, 184, 255); // steelblue

    pnlMain = new MainPanel(this);
    pnlMain.setName("Main");
    pnlMain.setBackground(color);
    pnlMain.setLayout(null);
    pnlScreen.add(pnlMain, "Main");

    pnlTexts = new TextsPanel(this);
    pnlTexts.setName("Texts");
    pnlScreen.add(pnlTexts, "Texts");
    pnlTexts.setBackground(color);
    pnlTexts.setLayout(null);

    pnlCalls = new CallsPanel(this);
    pnlCalls.setName("Calls");
    pnlScreen.add(pnlCalls, "Calls");
    pnlCalls.setBackground(color);
    pnlCalls.setLayout(null);

    pnlContacts = new ContactsPanel(this);
    pnlContacts.setName("Contacts");
    pnlScreen.add(pnlContacts, "Contacts");
    pnlContacts.setBackground(color);
    pnlContacts.setLayout(null);

    showPanel("Main");
  }
Esempio n. 3
0
  /** Function for refreshing the status area after editing status items */
  public void repaintToolbar() {

    // Lets start by adding all the notifications
    for (Entry<String, JLabel> entry : statusItems.entrySet()) {
      JLabel statusItem = entry.getValue();
      statusItem.setFont(new Font("Arial", Font.PLAIN, 11));
      statusItem.setForeground(new Color(237, 237, 237));
      statusPanel.add(statusItem);
    }

    // Then add all the highlighted vessel info
    highlightPanel.removeAll();
    JLabel highlightTitle = new JLabel(" Highlighted Vessel");
    highlightTitle.setFont(new Font("Arial", Font.BOLD, 11));
    highlightTitle.setForeground(new Color(237, 237, 237));
    if (highlightItems.size() > 0) {
      highlightTitle.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(65, 65, 65)));
      highlightPanel.add(highlightTitle);
    }
    for (Entry<String, JLabel> entry : highlightItems.entrySet()) {
      JLabel highlightItem = entry.getValue();
      highlightItem.setFont(new Font("Arial", Font.PLAIN, 11));
      highlightItem.setForeground(new Color(237, 237, 237));
      highlightPanel.add(highlightItem);
    }

    // Then calculate the size of the status bar according to the number of
    // status items
    width = statusItemWidth;
    int innerHeight = statusItems.size() * statusItemHeight;
    // Expanding width highlight size.
    int innerHeight2 = highlightItems.size() * statusItemHeight;
    if (highlightItems.size() > 0) {
      innerHeight2 += statusItemHeight;
    }

    // find height of the two areas plus 7 for separator
    height = innerHeight + innerHeight2 + 7;

    if (!locked) {
      height = innerHeight + innerHeight2 + moveHandlerHeight;
    }

    // And finally set the size and repaint it
    statusPanel.setSize(width, innerHeight - statusPanelOffset);
    statusPanel.setPreferredSize(new Dimension(width, innerHeight - statusPanelOffset));
    // Also for highlight panel
    highlightPanel.setSize(width, innerHeight2 - statusPanelOffset);
    highlightPanel.setPreferredSize(new Dimension(width, innerHeight2 - statusPanelOffset));
    this.setSize(width, height);
    this.revalidate();
    this.repaint();
  }
Esempio n. 4
0
 // Set up the quiz window
 Quiz() {
   initializeData();
   setTitle("FOSS Quiz App");
   setDefaultCloseOperation(EXIT_ON_CLOSE);
   setSize(440, 400);
   setLocation(300, 100);
   setResizable(true);
   Container cont = getContentPane();
   cont.setLayout(null);
   cont.setBackground(Color.WHITE);
   bg = new ButtonGroup();
   choice1 = new JRadioButton("Choice1", true);
   choice2 = new JRadioButton("Choice2", false);
   choice3 = new JRadioButton("Choice3", false);
   choice4 = new JRadioButton("Choice4", false);
   bg.add(choice1);
   bg.add(choice2);
   bg.add(choice3);
   bg.add(choice4);
   lblmess = new JLabel("Choose a correct anwswer");
   lblmess.setForeground(Color.BLACK);
   lblmess.setFont(new Font("Sans_Serif", Font.BOLD, 15));
   btnext = new JButton("Next");
   btnext.setForeground(Color.WHITE);
   btnext.setFont(new Font("Sans_Serif", Font.BOLD, 17));
   btnext.setBackground(Color.DARK_GRAY);
   btnext.addActionListener(this);
   panel = new JPanel();
   panel.setBackground(Color.WHITE);
   panel.setLocation(10, 60);
   panel.setSize(400, 300);
   panel.setLayout(new GridLayout(0, 1));
   title = new JPanel();
   title.setBackground(Color.WHITE);
   title.setLocation(10, 10);
   title.setSize(1000, 50);
   title.setLayout(new GridLayout(1, 0));
   title.add(lblmess);
   panel.add(choice1);
   panel.add(choice2);
   panel.add(choice3);
   panel.add(choice4);
   panel.add(btnext);
   cont.add(title);
   cont.add(panel);
   setVisible(true);
   quizAnswerID = 0;
   readQuestionAnswer(quizAnswerID);
 }
  public PleaseWaitFrame() throws HeadlessException {

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    int locationX = (int) (screenSize.getWidth() - FRAME_SIZE.getWidth()) / 2;
    int locationY = (int) (screenSize.getHeight() - FRAME_SIZE.getHeight()) / 2;
    this.setSize(FRAME_SIZE);
    this.setLocation(locationX, locationY);
    this.setUndecorated(true);
    this.setResizable(false);
    JPanel panel = new JPanel();

    GridBagLayout gbl = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.insets = new Insets(0, 0, 0, 0);
    gbc.fill = GridBagConstraints.CENTER;
    panel.setLayout(gbl);
    messageLabel = new JLabel(message);
    messageLabel.setFont(new Font(null, Font.BOLD, 25));
    panel.add(messageLabel, gbc);

    Border border = new LineBorder(Color.BLACK, 1);

    panel.setSize(FRAME_SIZE);

    panel.setBorder(border);

    this.setContentPane(panel);

    // super.setVisible(true);
    super.setVisible(false);
  }
Esempio n. 6
0
  /**
   * Erzeuge das Zusammenfassung-Panel, in dem die ausgewählten Verleihkarten im Detail angezeigt
   * werden.
   */
  private void erzeugeVerleihkartenAnzeiger() {
    JPanel verleihkartenAnzeigerPanel = new JPanel();
    BorderLayout detailsPanelLayout = new BorderLayout();
    _ruecknahmePanel.add(verleihkartenAnzeigerPanel, BorderLayout.CENTER);
    verleihkartenAnzeigerPanel.setLayout(detailsPanelLayout);
    verleihkartenAnzeigerPanel.setPreferredSize(new java.awt.Dimension(-1, -1));
    verleihkartenAnzeigerPanel.setSize(-1, -1);
    verleihkartenAnzeigerPanel.setBackground(UIConstants.BACKGROUND_COLOR);

    JScrollPane verleihkartenAnzeigerScrollPane = new JScrollPane();
    verleihkartenAnzeigerPanel.add(verleihkartenAnzeigerScrollPane, BorderLayout.CENTER);
    verleihkartenAnzeigerScrollPane.setPreferredSize(new java.awt.Dimension(-1, -1));
    verleihkartenAnzeigerScrollPane.setBorder(
        BorderFactory.createTitledBorder(
            null,
            "Ausgewählte Verleihkarten",
            TitledBorder.LEADING,
            TitledBorder.DEFAULT_POSITION,
            UIConstants.HEADER_FONT));
    verleihkartenAnzeigerScrollPane.setSize(-1, -1);
    verleihkartenAnzeigerScrollPane.setBackground(UIConstants.BACKGROUND_COLOR);
    verleihkartenAnzeigerScrollPane
        .getVerticalScrollBar()
        .setBackground(UIConstants.BACKGROUND_COLOR);
    verleihkartenAnzeigerScrollPane
        .getHorizontalScrollBar()
        .setBackground(UIConstants.BACKGROUND_COLOR);

    _verleihkartenAnzeigerTextArea = new JTextArea();
    _verleihkartenAnzeigerTextArea.setBackground(UIConstants.BACKGROUND_COLOR);
    verleihkartenAnzeigerScrollPane.setViewportView(_verleihkartenAnzeigerTextArea);
    _verleihkartenAnzeigerTextArea.setEditable(false);
    _verleihkartenAnzeigerTextArea.setFont(UIConstants.TEXT_FONT);
  }
 private JPanel getCrearAccionPanel() {
   if (crearAccionPanel == null) {
     accionLabel = new JLabel();
     accionLabel.setFont(new Font("Dialog", Font.BOLD, 12));
     accionLabel.setBounds(new Rectangle(45, 60, 97, 16));
     accionLabel.setText("Nombre acción:");
     categoriaLabel = new JLabel();
     categoriaLabel.setLocation(new Point(75, 30));
     categoriaLabel.setFont(new Font("Dialog", Font.BOLD, 12));
     categoriaLabel.setText("Categoría:");
     categoriaLabel.setSize(new Dimension(61, 16));
     crearAccionPanel = new JPanel();
     crearAccionPanel.setLayout(null);
     crearAccionPanel.setLocation(new Point(13, 13));
     crearAccionPanel.setSize(new Dimension(441, 102));
     crearAccionPanel.setBorder(
         BorderFactory.createTitledBorder(
             BorderFactory.createEtchedBorder(EtchedBorder.LOWERED),
             "Acción",
             TitledBorder.DEFAULT_JUSTIFICATION,
             TitledBorder.DEFAULT_POSITION,
             new Font("Dialog", Font.BOLD, 12),
             new Color(51, 51, 51)));
     crearAccionPanel.add(categoriaLabel, null);
     crearAccionPanel.add(accionLabel, null);
     crearAccionPanel.add(getCategoriaTextField(), null);
     crearAccionPanel.add(getAccionTextField(), null);
   }
   return crearAccionPanel;
 }
Esempio n. 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;
  }
Esempio n. 9
0
  private void initWindow() {
    window.setIconImage(fsuicon);
    window.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    window.setResizable(false);
    window.setLocation(400, 400);
    window.setSize(400, 600);
    window.setLayout(null);
    window.add(mainPanel);
    mainPanel.setSize(395, 570);
    mainPanel.setLayout(null);
    mainPanel.setBackground(garnet);
    mainPanel.setBorder(BorderFactory.createLineBorder(gold, 10));

    logoLBL = new JLabel(new ImageIcon(fsutitle));
    setJLabel(logoLBL, 372, 35, 10, 30);

    nameLBL = new JLabel(new ImageIcon(nametitle));
    nameLBL.setBorder(BorderFactory.createLineBorder(gold, 5));
    setJLabel(nameLBL, 400, 55, 0, 510);

    p1Stats = new JLabel();
    setJLabel(p1Stats, 150, 50, 20, 470);

    p2Stats = new JLabel();
    setJLabel(p2Stats, 150, 50, 225, 470);

    buildGridPanel();
    buildMenuPanel();
  }
Esempio n. 10
0
  public StudentUI(String userName) {
    tbar = new TitleBar(userName, frame);

    childp[0] = new HomePanel();
    childp[1] = new MyCoursePanel();
    childp[2] = new MyScorePanel();
    childp[3] = new ChooseCommonPanel();
    childp[4] = new ByelectPanel();

    switchPane.setSize(1000, 590);
    switchPane.setLocation(30, 140);
    switchPane.setLayout(mcl);

    for (int i = 0; i < mBtn.length; i++) {
      mBtn[i] = new MenuBtn(FUNC_BTN_NAME[i], FUNC_BTN_TEXT[i]);
      mbar.add(mBtn[i]);
      childp[i].setSize(800, 490);
      switchPane.add(childp[i], FUNC_BTN_NAME[i]);
    }

    mbar.setLocation(30, 100);
    mcl.show(switchPane, FUNC_BTN_NAME[0]);
    mBtn[0].setSelected(true);
    frame.add(switchPane);
    frame.add(mbar);
    frame.add(tbar);
    setListener();
    frame.setVisible(true);
  }
Esempio n. 11
0
  /**
   * A partir de un iterador de libros actualiza los resultados de un búsqueda donde se pueden
   * devolver libros.
   *
   * @param libros Iterador que apunta al primer libro del resultado de la búsqueda.
   */
  public void actualizarListaAlquilados(Iterador<ILibro> libros) {
    panelCentral.removeAll();
    anhanirLabeles();
    int i = 0;
    if (libros != null) {

      while (libros.haySiguiente()) {
        ILibro libro = libros.darSiguiente();
        panelCentral.add(new PanelLibroAlquilado(libro, principal));
        i++;
      }
      if (i <= 5) layout.setRows(7);
      else {
        layout.setRows(i + 2);
        panelCentral.setSize(511, i * 146);
      }
      for (int j = i + 2; j < 6; j++) {
        JPanel panel = new JPanel();
        panel.setBackground(Color.WHITE);
        panelCentral.add(panel);
      }
      labelMostrarResultados.setText("Resultados de la búsqueda: " + i);
      panelCentral.repaint();
    }
  }
Esempio n. 12
0
  private void createCells() {
    // Sets the right size for the panel and sets up a GridBagLayout
    grid.setSize(rows * 18, (cols * 18) + 22);
    GridBagLayout gridBag = new GridBagLayout();
    GridBagConstraints g = new GridBagConstraints();
    grid.setLayout(gridBag);

    // Creates the arrays needed for the cells
    cells = new JLabel[rows][cols];
    alive = new boolean[rows][cols];
    mark = new boolean[rows][cols];

    // Two for loops with which we can reach every cell
    for (int x = 0; x < rows; x++) {
      for (int y = 0; y < cols; y++) {
        // Makes a new JLabel for each cell, sets its icon to blank, and adds a border
        cells[x][y] = new JLabel();
        cells[x][y].setIcon(white);
        cells[x][y].setBorder(BorderFactory.createLineBorder(Color.GRAY, 1));

        // All cells start dead and not marked for change
        alive[x][y] = false;
        mark[x][y] = false;

        // Adds the mouselistener to each cell so it's state can be changed
        cells[x][y].addMouseListener(click);

        // Adds the cell to the correct position in the grid
        g.gridx = x;
        g.gridy = y;
        grid.add(cells[x][y], g);
      }
    }
  }
  private JPanel createContentPane() {
    JPanel panel = new JPanel();

    combo1 = new JComboBox<>(numData);
    panel.add(combo1);
    combo2 = new JComboBox<>(dayData);
    combo2.setEditable(true);
    panel.add(combo2);
    panel.setSize(300, 200);

    popupMenu = new JPopupMenu();
    JMenuItem item;
    for (int i = 0; i < dayData.length; i++) {
      item = popupMenu.add(new JMenuItem(dayData[i], mnDayData[i]));
      item.addActionListener(this);
    }
    panel.addMouseListener(new PopupListener(popupMenu));

    JTextField field = new JTextField("CTRL+down for Popup");
    // CTRL-down will show the popup.
    field
        .getInputMap()
        .put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.CTRL_MASK), "OPEN_POPUP");
    field.getActionMap().put("OPEN_POPUP", new PopupHandler());

    panel.add(field);

    return panel;
  }
  private void resetRemainderProblems() {

    problemDisplays = new RemainderProblemDisplay[round.getNumProblems()];

    JPanel panel = new JPanel();
    panel.setMinimumSize(new Dimension(2, 2));
    panel.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
    for (int i = round.getNumProblems() / 4 + (round.getNumProblems() % 4 == 0 ? 0 : 1);
        i >= 0;
        i--) {
      panel.setSize(new Dimension(370, panel.getSize().height + 60));
    }
    panel.setLayout(new Layout(0, 4));

    for (int i = 0; i < round.getNumProblems(); i++) {
      RemainderProblemDisplay problem =
          new RemainderProblemDisplay(
              round.getProblem(i), round.getGenerator().getParam().charAt(0));
      problemDisplays[i] = problem;
      panel.add(problem);
    }
    panel.revalidate();
    problems.setPreferredSize(new Dimension(388, 360));
    problems.setViewportView(panel);
    problems.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    problems.revalidate();
  }
Esempio n. 15
0
  public void createGUI() {
    setLayout(new BorderLayout());

    buttonPanel.add(submitButton);
    buttonPanel.setSize(400, 400);
    hostPanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    ImageIcon imageIcon = new ImageIcon("images/logo.png"); // load the image to a imageIcon
    Image image = imageIcon.getImage(); // transform it
    Image newimg =
        image.getScaledInstance(600, 120, java.awt.Image.SCALE_SMOOTH); // scale it the smooth way
    imageIcon = new ImageIcon(newimg); // transform it back
    JLabel scrabbleLabel = new JLabel(imageIcon, SwingConstants.CENTER);
    add(scrabbleLabel, BorderLayout.NORTH);
    gbc.gridx = 0;
    gbc.gridy = 0;
    hostPanel.add(hostLabel, gbc);
    gbc.gridx = 0;
    gbc.insets = new Insets(46, 0, 46, 0);
    gbc.gridy = 1;
    hostPanel.add(portLabel, gbc);
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.anchor = GridBagConstraints.EAST;
    hostPanel.add(portTF, gbc);
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.gridx = 0;
    gbc.gridy = 2;
    gbc.gridwidth = 2;
    hostPanel.add(buttonPanel, gbc);
    add(hostPanel, BorderLayout.CENTER);
  }
Esempio n. 16
0
  /**
   * The constructor for the SaveDialog class
   *
   * @param parent The LevelEditor class
   */
  public SaveDialog(LevelEditor parent) {
    super();
    le = parent;

    setTitle("SaveDialog");
    setSize(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT);
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    setLocationRelativeTo(null);
    setResizable(false);

    textField = new JTextField(10);

    String msgString1 = "Please enter filename:";
    JLabel label = new JLabel(msgString1);
    JButton saveButton = new JButton(btnString1);
    saveButton.setActionCommand(btnString1);
    saveButton.addActionListener(this);
    JButton cancelButton = new JButton(btnString2);
    cancelButton.setActionCommand(btnString2);
    cancelButton.addActionListener(this);
    JPanel text = new JPanel();
    text.setLayout(new BoxLayout(text, BoxLayout.Y_AXIS));
    text.setSize(200, 40);
    text.add(label);
    text.add(textField);
    JPanel buttons = new JPanel();
    buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
    buttons.add(saveButton);
    buttons.add(cancelButton);
    add(text);
    add(buttons);
    setVisible(true);
  }
  public GameWindow(WelcomeWindow h, Player white, Player black) {
    super("Lines Of Action");
    restart = h;
    setLayout(null); // 3ashan n3raf nzabatha bra7tna
    Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
    setSize(screenDimension);
    setResizable(false);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setVisible(true);
    this.setIconImage(
        new ImageIcon(this.getClass().getResource("Game-Center-icon.png")).getImage());

    game = new Board();
    game.getBlackPlayer().setName(black.getName());
    game.getWhitePlayer().setName(white.getName());

    Player[] players = new Player[2];

    players[0] = game.getWhitePlayer();
    players[1] = game.getBlackPlayer();

    rightPanel = new RightSidePanel(this, h, this.getContentPane().getSize(), players);

    rightPanel.addMouseListener(this);

    gamePanel = new JPanel();
    gamePanel.setLayout(null);
    gamePanel.setSize(this.getContentPane().getSize());
    updateBoard();

    this.getContentPane().add(rightPanel);
    this.getContentPane().add(gamePanel);
    this.validate();
    this.repaint();
  }
  @Override
  public void setComponentValues(BaseModelObject baseModelObject) {
    for (PropertyObjectDefinition property : definitions) {
      if (propertyFields.containsKey(property) == true) {
        PropertyField propertyField = propertyFields.get(property);
        StyledLabel propertyLabel = propertyLabels.get(property);

        propertyField.setComponentValue(baseModelObject);
        propertyLabel.setVisible(propertyField.isVisible());
      }
    }

    boolean visible = false;
    for (int i = 0; i < contentPanel.getComponentCount(); i++) {
      Component component = contentPanel.getComponent(i);

      if (component.isVisible() == true) {
        visible = true;
        break;
      }
    }

    setVisible(visible);

    revalidate();

    Dimension preferredSize = contentPanel.getPreferredSize();
    contentPanel.setSize(preferredSize);
    contentPanel.setMinimumSize(preferredSize);
  }
Esempio n. 19
0
 public JPanel createMasterPanel() {
   JPanel jpanel = new JPanel();
   jpanel.setSize(100, 100);
   jpanel.setLayout(new BorderLayout());
   // jpanel.setBackground(Color.WHITE);
   return jpanel;
 }
  public void ListePaletteConteneur(int numero) {

    try {

      Connexion connec = new Connexion(Connexion.log, Connexion.password);
      ResultSet rs = connec.listerPaletteConteneur(numero);

      if (rs.next()) {

        rs.previous();

        String[] nomColonnes = {"id_colis"};

        LinkedList<Object[]> liste = new LinkedList<Object[]>();
        Object[][] donnees;

        while (rs.next()) {
          Object[] data = new Object[8];

          data[0] = rs.getString(1);

          liste.add(data);
        }

        donnees = new Object[liste.size()][];

        for (int i = 0; i < donnees.length; i++) {
          donnees[i] = liste.get(i);
        }

        for (int i = 0; i < 8; i++) System.out.println(nomColonnes[i]);
        table = new JTable(donnees, nomColonnes);

        jp = new JPanel();

        jp.setLayout(new BorderLayout());
        jp.add(table.getTableHeader(), BorderLayout.PAGE_START);
        scroll = new JScrollPane(table);

        jp.add(scroll, BorderLayout.CENTER);

        jp.setVisible(true);
        jp.setSize(800, 700);

        fermer.addActionListener(this);
        JPanel panel = new JPanel(new BorderLayout());
        panel.add(jp, BorderLayout.CENTER);
        panel.add(fermer, BorderLayout.SOUTH);
        this.setContentPane(panel);
        this.setVisible(true);
      }

    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
Esempio n. 21
0
  private JPanel getJContentPane() {
    if (jContentPane == null) {
      jLabel6 = new JLabel();
      jLabel6.setBounds(new Rectangle(11, 72, 218, 19));
      jLabel6.setText("Install log directory:");
      jLabel5 = new JLabel();
      jLabel5.setBounds(new Rectangle(11, 2, 394, 26));
      jLabel5.setText("Advanced Install. Please select your preferences");
      ButtonGroup group = new ButtonGroup();
      pathSuffix = new JTextArea();
      pathSuffix.setBounds(new Rectangle(232, 48, 61, 21));
      pathSuffix.setText("BIRCH");
      jLabel4 = new JLabel();
      jLabel4.setBounds(new Rectangle(22, 351, 312, 20));
      jLabel4.setText("* - Automatically detected, recommended.");
      jLabel3 = new JLabel();
      jLabel3.setBounds(new Rectangle(220, 48, 10, 21));
      jLabel3.setText(" /");
      jLabel2 = new JLabel();
      jLabel2.setBounds(new Rectangle(18, 250, 132, 18));
      jLabel2.setText("Binaries:");
      jLabel1 = new JLabel();
      jLabel1.setBounds(new Rectangle(11, 115, 127, 21));
      jLabel1.setText("Framework Type:");
      jLabel = new JLabel();
      jLabel.setBounds(new Rectangle(11, 28, 131, 17));
      jLabel.setText("Install directory:");
      jContentPane = new JPanel();
      jContentPane.setLayout(null);
      jContentPane.setSize(new Dimension(464, 376));
      jContentPane.add(jLabel, null);
      jContentPane.add(getJButton(), null);
      jContentPane.add(getJTextArea(), null);
      jContentPane.add(jLabel3, null);
      jContentPane.add(pathSuffix, null);
      jContentPane.add(jLabel1, null);
      jContentPane.add(getJCheckBox(), null);
      jContentPane.add(getJCheckBox1(), null);
      jContentPane.add(jLabel2, null);
      jContentPane.add(getJCheckBox2(), null);
      jContentPane.add(getJCheckBox3(), null);
      jContentPane.add(getJCheckBox4(), null);
      jContentPane.add(getJCheckBox5(), null);
      jContentPane.add(getJCheckBox6(), null);

      jContentPane.add(getLogTextField(), null);
      jContentPane.add(getLogButton(), null);
      jContentPane.add(jLabel4, null);
      jContentPane.add(getWindows32Checkbox(), null);
      jContentPane.add(getJRadioButton(), null);
      jContentPane.add(jLabel5, null);
      jContentPane.add(jLabel6, null);
      jContentPane.add(getGitRadioButton(), null);
      jContentPane.add(getGitComboBox(), null);
      group.add(releaseRadioButton);
      group.add(developmentRadioButton);
      group.add(gitRadioButton);
    }
    return jContentPane;
  }
Esempio n. 22
0
 private JPanel buttonsLayout() {
   JPanel panel = new JPanel();
   GroupLayout layout = new GroupLayout(panel);
   layout.setAutoCreateContainerGaps(true);
   layout.setAutoCreateGaps(true);
   panel.setLayout(layout);
   layout.setHorizontalGroup(
       layout
           .createParallelGroup(GroupLayout.Alignment.LEADING)
           .addGroup(
               layout
                   .createSequentialGroup()
                   .addComponent(play)
                   .addComponent(nextClock)
                   .addComponent(pause)
                   .addComponent(open))
           .addComponent(bypass));
   layout.setVerticalGroup(
       layout
           .createSequentialGroup()
           .addGroup(
               layout
                   .createParallelGroup(GroupLayout.Alignment.CENTER)
                   .addComponent(play)
                   .addComponent(nextClock)
                   .addComponent(pause)
                   .addComponent(open))
           .addComponent(bypass));
   Dimension d = new Dimension(220, panel.getHeight());
   panel.setSize(d);
   panel.setPreferredSize(d);
   return panel;
 }
Esempio n. 23
0
  public void drawParams() {
    if (monParams.size() > 0) {
      SpringUtilities.makeCompactGrid(monPanel, monParams.size(), 2, 6, 6, 6, 6);
      SpringLayout sl = (SpringLayout) monPanel.getLayout();
      Dimension d = sl.minimumLayoutSize(monPanel);
      monPanel.setSize(d);
    }
    if (steerParams.size() > 0) {
      SpringUtilities.makeCompactGrid(steerPanel, steerParams.size(), 3, 6, 6, 6, 6);
      SpringLayout sl = (SpringLayout) steerPanel.getLayout();
      Dimension d = sl.minimumLayoutSize(steerPanel);
      steerPanel.setSize(d);
    }

    tabs.insertTab("Parameters", null, paramPanel, "", 0);
  }
  private JPanel createDraggablePane() {
    System.out.println("creating a new draggable pane");
    String value = JOptionPane.showInputDialog("Say what?");

    if (value == null) return null;

    JPanel pane = new JPanel();
    JLabel lbl = new JLabel(value);
    lbl.setHorizontalAlignment(JLabel.CENTER);

    pane.setLayout(new BorderLayout());
    pane.add(lbl, BorderLayout.CENTER);
    pane.setSize(100, 50);
    pane.setBackground(Color.CYAN);
    pane.setBorder(new LineBorder(Color.BLACK, 1));

    dragSources.add(makeDraggablePaneProducer(pane));

    pane.addMouseListener(
        new MouseAdapter() {

          @Override
          public void mousePressed(MouseEvent e) {
            System.out.println("draggable-mouse-pressed");
          }

          @Override
          public void mouseReleased(MouseEvent e) {
            System.out.println("draggable-mouse-released");
          }
        });

    return pane;
  }
Esempio n. 25
0
 @Override
 public void setSize(final int WIDTH, final int HEIGHT) {
   super.setSize(WIDTH, HEIGHT);
   calcInnerBounds();
   init(WIDTH, HEIGHT); // Rectangular component
   revalidate();
   repaint();
 }
Esempio n. 26
0
 private void setUpMainPanel() {
   JPanel mainPanel = (JPanel) getContentPane();
   mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
   // makeOKButton(mainPanel);
   makeOptionPane(mainPanel);
   mainPanel.setSize(300, 200);
   mainPanel.setMinimumSize(new Dimension(300, 200));
 }
Esempio n. 27
0
 @Override
 public void setSize(final java.awt.Dimension DIM) {
   super.setSize(DIM);
   calcInnerBounds();
   init(DIM.width, DIM.height);
   revalidate();
   repaint();
 }
Esempio n. 28
0
 /**
  * Erzeugt das Hauptpanel, in dem sich Verleihkartenauflister, Verleihkartenanzeiger und
  * Rücknahme-Button befinden.
  */
 private void erzeugeHauptPanel() {
   _hauptPanel = new JPanel();
   _hauptPanel.setLayout(new BorderLayout());
   _hauptPanel.setPreferredSize(new java.awt.Dimension(-1, -1));
   _hauptPanel.setSize(-1, -1);
   _hauptPanel.setAutoscrolls(true);
   _hauptPanel.setBackground(UIConstants.BACKGROUND_COLOR);
 }
Esempio n. 29
0
 private void showCommentPane() {
   panelComment.add(commentPane, BorderLayout.CENTER);
   panelComment.setSize(new Dimension(panel.getWidth() - 20, 120));
   panelComment.setPreferredSize(new Dimension(panel.getWidth() - 20, 120));
   panelComment.setMaximumSize(new Dimension(panel.getWidth() - 20, 120));
   panelComment.revalidate();
   panelComment.repaint();
 }
Esempio n. 30
0
 private JPanel memoriesLayout() {
   JPanel panel = new JPanel(new GridLayout(6, 1));
   panel.add(memories);
   for (int i = 0; i < 5; i++) panel.add(memory[i]);
   Dimension d = new Dimension(220, panel.getHeight());
   panel.setSize(d);
   panel.setPreferredSize(d);
   return panel;
 }