Example #1
0
  public void updateShowHideCalendars(ArrayList<User> users) {
    GroupLayout layout = new GroupLayout(showHideCalendarsPanel);
    showHideCalendarsPanel.setLayout(layout);

    labels = new ArrayList<JLabel>(); // emptying the list
    for (int i = 0; i < users.size(); i++) {
      JLabel temp = new JLabel();
      temp.addMouseListener(mouseTempListener(temp));

      temp.setText(users.get(i).getName());
      temp.setBackground(Color.white);

      temp.setOpaque(true);
      temp.setIcon(tick);
      temp.setIconTextGap(10);
      temp.setBorder(BorderFactory.createEmptyBorder(3, 10, 3, 10));
      labels.add(temp);
    }

    ParallelGroup showHideCalendarsHorizontalGroup =
        layout.createParallelGroup(GroupLayout.Alignment.LEADING);
    for (int i = 0; i < labels.size(); i++) {
      showHideCalendarsHorizontalGroup.addComponent(
          labels.get(i), GroupLayout.DEFAULT_SIZE, 335, Short.MAX_VALUE);
    }

    SequentialGroup showHideCalendarsVerticalGroup = layout.createSequentialGroup();
    for (int i = 0; i < labels.size(); i++) {
      showHideCalendarsVerticalGroup.addComponent(
          labels.get(i), GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE);
    }

    layout.setHorizontalGroup(showHideCalendarsHorizontalGroup);
    layout.setVerticalGroup(showHideCalendarsVerticalGroup);
  }
  private JScrollPane makeTab(String type) {
    JPanel panel = new JPanel();
    GroupLayout layout = new GroupLayout(panel);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);
    panel.setLayout(layout);

    JScrollPane scroll =
        new JScrollPane(
            panel,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scroll.setLayout(new ScrollPaneLayout());

    SequentialGroup sg = layout.createSequentialGroup();
    ParallelGroup pg = layout.createParallelGroup();

    String editString = "Edit " + type + "s";
    JButton editType = new JButton(editString);

    editType.addActionListener(new EditListener(myWorldManager, type, this));

    sg.addComponent(editType);
    pg.addComponent(editType);

    List<String> tileNames = myWorldManager.getNames(type);
    for (int n = 0; n < tileNames.size(); n++) {
      GameObjectPanel gop =
          new GameObjectPanel(type, myWorldManager.getImage(type, n), tileNames.get(n), this);
      panel.add(gop);
      sg.addComponent(gop, 50, 50, 50);
      pg.addComponent(gop, 170, 170, 170);
    }
    layout.setVerticalGroup(sg);
    layout.setHorizontalGroup(pg);
    panel.revalidate();
    panel.repaint();
    scroll.setMaximumSize(new Dimension(200, 500));
    return scroll;
  }
  private void initLayout() { // {{{
    layout = new javax.swing.GroupLayout(listPanel);

    super.setLayout(blayout);
    layout.setHonorsVisibility(true);
    // layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);

    ParallelGroup pg = layout.createParallelGroup(Alignment.LEADING);
    SequentialGroup sg = layout.createSequentialGroup();
    pg = pg.addGroup(sg);
    // add components to this one.
    vgroup = layout.createParallelGroup(Alignment.LEADING);
    sg.addGroup(vgroup);
    layout.setHorizontalGroup(pg);

    // Add out components to this one.
    hgroup = layout.createSequentialGroup();
    ParallelGroup pg1 = layout.createParallelGroup(Alignment.LEADING).addGroup(hgroup);
    layout.setVerticalGroup(pg1);
    // Add the listPanel to our layout
    listPanel.setLayout(layout);
    add(userListPane, BorderLayout.CENTER);
    setupToolBar();
    add(toolbar, BorderLayout.NORTH);
    btnNext.setEnabled(false);
    btnPrev.setEnabled(false);

    userListPane.setHorizontalScrollBarPolicy(
        javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    userListPane.setVerticalScrollBarPolicy(
        javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    userListPane.setAutoscrolls(true);
    userListPane.setName("userListPane"); // NOI18N
    userListPane.setViewportView(listPanel);
    javax.swing.JScrollBar bar = userListPane.getVerticalScrollBar();
    bar.setUnitIncrement(50);
    TwitzMainView.fixJScrollPaneBarsSize(userListPane);
  } // }}}
Example #4
0
  public void updateAgenda(ArrayList<Event> eventsList) {
    GroupLayout layout = new GroupLayout(agendaPanel);
    agendaPanel.setLayout(layout);

    System.out.println("number of agendas: " + eventsList.size());
    eventLabels = new ArrayList<JLabel>();
    // Collections.sort(eventsList, new TimeComparator()); //Sorts the list based on when the event
    // is
    for (int i = 0; i < eventsList.size(); i++) {
      JLabel temp = new JLabel();
      temp.setText(
          eventsList.get(i).getTitle() + " - " + eventsList.get(i).getStartTime().toGMTString());
      temp.setOpaque(true);
      if (i % 2 == 0) {
        temp.setBackground(Color.white);
      } else {
        temp.setBackground(new Color(245, 245, 245));
      }
      temp.setBorder(BorderFactory.createEmptyBorder(3, 10, 3, 10));
      eventLabels.add(temp);
    }

    ParallelGroup agendaHorizontalGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING);
    for (int i = 0; i < eventLabels.size(); i++) {
      agendaHorizontalGroup.addComponent(
          eventLabels.get(i), GroupLayout.DEFAULT_SIZE, 335, Short.MAX_VALUE);
    }

    SequentialGroup agendaVerticalGroup = layout.createSequentialGroup();
    for (int i = 0; i < eventLabels.size(); i++) {
      agendaVerticalGroup.addComponent(
          eventLabels.get(i), GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE);
    }

    layout.setHorizontalGroup(agendaHorizontalGroup);
    layout.setVerticalGroup(agendaVerticalGroup);
  }
Example #5
0
  @Deprecated
  public void layoutButtons() {
    createLoginButton();
    createHomeButton();
    Container pane = getContentPane();
    GroupLayout gl = new GroupLayout(pane);
    pane.setLayout(gl);

    SequentialGroup horizontalGroup = gl.createSequentialGroup();
    SequentialGroup verticalGroup = gl.createSequentialGroup();
    horizontalGroup.addComponent(loginButton);
    horizontalGroup.addComponent(homeButton);
    verticalGroup.addComponent(loginButton);
    verticalGroup.addComponent(homeButton);

    gl.setAutoCreateContainerGaps(true);
    gl.setHorizontalGroup(horizontalGroup);
    gl.setVerticalGroup(verticalGroup);
    // gl.setHorizontalGroup(gl.createSequentialGroup().addComponent(
    // homeButton));
    // gl.setVerticalGroup(gl.createSequentialGroup().addComponent(homeButton));
  }
  private void initComponents() {
    entry = new JTextField();
    textArea = new JTextArea();
    status = new JLabel();
    jLabel1 = new JLabel();

    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    setTitle("TextFieldDemo");

    textArea.setColumns(20);
    textArea.setLineWrap(true);
    textArea.setRows(5);
    textArea.setWrapStyleWord(true);
    textArea.setEditable(false);
    jScrollPane1 = new JScrollPane(textArea);

    jLabel1.setText("Enter text to search:");

    GroupLayout layout = new GroupLayout(getContentPane());
    getContentPane().setLayout(layout);

    ParallelGroup hGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING);

    SequentialGroup h1 = layout.createSequentialGroup();
    ParallelGroup h2 = layout.createParallelGroup(GroupLayout.Alignment.TRAILING);

    h1.addContainerGap();

    h2.addComponent(
        jScrollPane1,
        GroupLayout.Alignment.LEADING,
        GroupLayout.DEFAULT_SIZE,
        450,
        Short.MAX_VALUE);
    h2.addComponent(
        status, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 450, Short.MAX_VALUE);

    SequentialGroup h3 = layout.createSequentialGroup();
    h3.addComponent(jLabel1);
    h3.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
    h3.addComponent(entry, GroupLayout.DEFAULT_SIZE, 321, Short.MAX_VALUE);

    h2.addGroup(h3);
    h1.addGroup(h2);

    h1.addContainerGap();

    hGroup.addGroup(GroupLayout.Alignment.TRAILING, h1);
    layout.setHorizontalGroup(hGroup);

    ParallelGroup vGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING);
    SequentialGroup v1 = layout.createSequentialGroup();
    v1.addContainerGap();
    ParallelGroup v2 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
    v2.addComponent(jLabel1);
    v2.addComponent(
        entry, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE);
    v1.addGroup(v2);
    v1.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED);
    v1.addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE);

    v1.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED);
    v1.addComponent(status);
    v1.addContainerGap();

    vGroup.addGroup(v1);
    layout.setVerticalGroup(vGroup);
    pack();
  }
  private void initComponents() {
    // Start with indeterminate
    progressBar.setIndeterminate(false);

    // the text fields are not editable
    authUrlText.setEditable(false);
    repoUrlText.setEditable(false);
    stackStatusText.setEditable(false);
    statusTable.setEnabled(false);
    totalText.setEditable(false);
    // seupt the layout
    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);
    this.setBorder(border);
    // Use default gaps
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);
    // Horizontal
    ParallelGroup h1 = layout.createParallelGroup(GroupLayout.Alignment.TRAILING);
    h1.addComponent(authStaticLabel);
    h1.addComponent(repoStaticLabel);
    h1.addComponent(stackStatusLabel);
    h1.addComponent(totalLabel);
    ParallelGroup h2 = layout.createParallelGroup(GroupLayout.Alignment.LEADING);
    h2.addComponent(authUrlText);
    h2.addComponent(repoUrlText);
    h2.addComponent(stackStatusText);
    h2.addComponent(totalText);
    ParallelGroup h3 = layout.createParallelGroup(GroupLayout.Alignment.LEADING);
    h3.addComponent(changeStatus);
    SequentialGroup hSequence = layout.createSequentialGroup();
    hSequence.addGroup(h1);
    hSequence.addGroup(h2);
    hSequence.addGroup(h3);

    ParallelGroup h4 = layout.createParallelGroup(GroupLayout.Alignment.LEADING);
    h4.addComponent(progressLabel);
    h4.addComponent(progressBar);
    h4.addComponent(tableScrollPane);

    ParallelGroup hOuter = layout.createParallelGroup(GroupLayout.Alignment.LEADING);
    hOuter.addGroup(hSequence);
    hOuter.addGroup(h4);

    // Vertical
    ParallelGroup v1 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
    v1.addComponent(authStaticLabel);
    v1.addComponent(authUrlText);
    ParallelGroup v2 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
    v2.addComponent(repoStaticLabel);
    v2.addComponent(repoUrlText);
    ParallelGroup v3 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
    v3.addComponent(stackStatusLabel);
    v3.addComponent(stackStatusText);
    v3.addComponent(changeStatus);
    ParallelGroup v4 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
    v4.addComponent(progressLabel);
    ParallelGroup v5 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
    v5.addComponent(progressBar);
    ParallelGroup v6 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
    v6.addComponent(tableScrollPane);
    ParallelGroup v7 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
    v7.addComponent(totalLabel);
    v7.addComponent(totalText);

    SequentialGroup vSequence = layout.createSequentialGroup();
    vSequence.addGroup(v1);
    vSequence.addGroup(v2);
    vSequence.addGroup(v3);
    vSequence.addGroup(v4);
    vSequence.addGroup(v5);
    vSequence.addGroup(v6);
    vSequence.addGroup(v7);

    layout.setHorizontalGroup(hOuter);
    layout.setVerticalGroup(vSequence);

    setPreferredSize(new Dimension(300, 400));
  }
  private JPanel makeAPI() {
    JPanel p = new JPanel();
    GroupLayout layout = new GroupLayout(p);
    p.setLayout(layout);

    Group hg1 = layout.createParallelGroup();
    Group hg2 = layout.createParallelGroup();
    SequentialGroup vg = layout.createSequentialGroup();
    final int pref = GroupLayout.PREFERRED_SIZE;

    JComponent[] targs = initializeTargets();

    for (int i = 0; i < targs.length; i++) {
      JLabel label = new JLabel(labels[i]);

      hg1.addComponent(label);
      hg2.addComponent(targs[i]);

      vg.addGroup(
          layout
              .createParallelGroup(Alignment.BASELINE)
              /**/ .addComponent(label)
              /**/ .addComponent(targs[i], pref, pref, pref));
    }

    tfAuth = new JTextField(null);
    taDesc = new JTextArea();
    tfAuth.setEditable(false);
    taDesc.setEditable(false);
    taDesc.setLineWrap(true);
    taDesc.setWrapStyleWord(true);

    JLabel lAuth =
        new JLabel(Messages.getString("EnigmaSettingsFrame.LABEL_AUTHOR")); // $NON-NLS-1$
    JScrollPane desc = new JScrollPane(taDesc);

    layout.setHorizontalGroup(
        layout
            .createParallelGroup()
            /**/ .addGroup(
                layout
                    .createSequentialGroup()
                    /*	*/ .addGroup(hg1)
                    /*	*/ .addPreferredGap(ComponentPlacement.RELATED)
                    /*	*/ .addGroup(hg2))
            /**/ .addGroup(
                layout
                    .createSequentialGroup()
                    /*	*/ .addComponent(lAuth)
                    /*	*/ .addPreferredGap(ComponentPlacement.RELATED)
                    /*	*/ .addComponent(tfAuth))
            /**/ .addComponent(desc));
    layout.setVerticalGroup(
        vg
            /**/ .addPreferredGap(ComponentPlacement.RELATED)
            /**/ .addGroup(
                layout
                    .createParallelGroup(Alignment.BASELINE)
                    /*	*/ .addComponent(lAuth)
                    /*	*/ .addComponent(tfAuth))
            /**/ .addPreferredGap(ComponentPlacement.RELATED)
            /**/ .addComponent(desc, 0, 0, Integer.MAX_VALUE));

    return p;
  }
  private JPanel makeSettings() {
    JPanel p = new JPanel();
    GroupLayout layout = new GroupLayout(p);
    p.setLayout(layout);

    List<JPanel> panels = generateOptionPanels();

    sDef = new SimpleCodeHolder(res.definitions);
    sGlobLoc = new SimpleCodeHolder(res.globalLocals);
    sInit = new SimpleCodeHolder(res.initialization);
    sClean = new SimpleCodeHolder(res.cleanup);

    bDef =
        new JButton(
            Messages.getString("EnigmaSettingsFrame.BUTTON_DEFINITIONS"), CODE_ICON); // $NON-NLS-1$
    bGlobLoc =
        new JButton(
            Messages.getString("EnigmaSettingsFrame.BUTTON_GLOBAL_LOCALS"),
            CODE_ICON); //$NON-NLS-1$
    bInit =
        new JButton(
            Messages.getString("EnigmaSettingsFrame.BUTTON_INITIALIZATION"),
            CODE_ICON); //$NON-NLS-1$
    bClean =
        new JButton(
            Messages.getString("EnigmaSettingsFrame.BUTTON_CLEANUP"), CODE_ICON); // $NON-NLS-1$

    bDef.addActionListener(this);
    bGlobLoc.addActionListener(this);
    bInit.addActionListener(this);
    bClean.addActionListener(this);

    Group gh = layout.createParallelGroup();
    SequentialGroup gv = layout.createSequentialGroup();
    if (panels != null)
      for (JPanel pp : panels) {
        gh.addComponent(pp);
        gv.addComponent(pp);
      }

    layout.setHorizontalGroup(
        gh
            /**/ .addGroup(
                layout
                    .createSequentialGroup()
                    /*	*/ .addComponent(bDef)
                    /*	*/ .addComponent(bGlobLoc))
            /**/ .addGroup(
                layout
                    .createSequentialGroup()
                    /*	*/ .addComponent(bInit)
                    /*	*/ .addComponent(bClean)));
    layout.setVerticalGroup(
        gv
            /**/ .addGroup(
                layout.createParallelGroup() /*	*/.addComponent(bDef) /*	*/.addComponent(bGlobLoc))
            /**/ .addGroup(
                layout.createParallelGroup() /*	*/.addComponent(bInit) /*	*/.addComponent(bClean))
            /**/ .addContainerGap());

    return p;
  }
Example #10
0
 public void addPanel(Component comp) // {{{
     {
   vgroup.addComponent(comp, 0, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE);
   hgroup.addComponent(comp, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE);
 } // }}}