public PE1212_UseLabels() {
    setLayout(new FlowLayout());

    ImageIcon usFlag = new ImageIcon("C://Java//site//image//usIcon.gif");

    JLabel jlbl1 = new JLabel(usFlag);
    jlbl1.setText("US");
    jlbl1.setHorizontalTextPosition(JLabel.CENTER);
    jlbl1.setVerticalTextPosition(JLabel.BOTTOM);

    JLabel jlbl2 = new JLabel(usFlag);
    jlbl2.setText("US");
    jlbl2.setHorizontalTextPosition(JLabel.RIGHT);

    JLabel jlbl3 = new JLabel(usFlag);
    jlbl3.setText("US");
    jlbl3.setHorizontalTextPosition(JLabel.LEFT);

    JLabel jlbl4 = new JLabel(usFlag);
    jlbl4.setText("US");
    jlbl4.setHorizontalTextPosition(JLabel.CENTER);
    jlbl4.setVerticalTextPosition(JLabel.TOP);

    add(jlbl1);
    add(jlbl2);
    add(jlbl3);
    add(jlbl4);
  }
Esempio n. 2
0
  public NormalMapDemo() {
    super("Normal map conversion demo");

    setSize(1280, 1024);
    setLocation(0, 0);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    textureUtils = new TextureCreateUtils();

    JPanel p1 = new JPanel(new BorderLayout());

    srcIcon = new ImageIcon();
    srcLabel = new JLabel();
    srcLabel.setVerticalTextPosition(SwingConstants.BOTTOM);
    srcLabel.setText("Source Image");

    mapIcon = new ImageIcon();
    mapLabel = new JLabel();
    mapLabel.setVerticalTextPosition(SwingConstants.BOTTOM);
    mapLabel.setText("NormalMap Image");

    JButton b = new JButton("Open A file");
    b.addActionListener(this);

    p1.add(b, BorderLayout.SOUTH);
    p1.add(srcLabel, BorderLayout.WEST);
    p1.add(mapLabel, BorderLayout.EAST);

    getContentPane().add(p1);
  }
Esempio n. 3
0
File: frame.java Progetto: ApolZ/GUI
  public static void main(String[] args) {
    JPanel panel = new JPanel();
    JPanel sub1 = new PushCounterPanel(Color.yellow);
    JPanel sub2 = new CalculatorPanel();
    panel.add(sub1);
    panel.add(sub2);

    // 八爪猫实力上镜展示panel,label,imageIcon
    ImageIcon icon = new ImageIcon("resource/octocat.jpeg");
    icon.setImage(icon.getImage().getScaledInstance(30, 30, Image.SCALE_DEFAULT));
    JLabel label1 =
        new JLabel(
            "Cat on the left", icon, SwingConstants.CENTER); // 第三个参数,label在panel中水平方向定位,默认为CENTER
    JLabel label2 = new JLabel("Cat on the right");
    label2.setIcon(icon);
    label2.setHorizontalTextPosition(SwingConstants.LEFT); // label中,文字相对图像的水平位子,默认为RIGHT
    label2.setVerticalTextPosition(SwingConstants.BOTTOM); // label中,文字相对图像的垂直位子,默认为CENTER
    JPanel sub3 = new JPanel();
    sub3.add(label1);
    sub3.add(label2);
    sub3.setPreferredSize(new Dimension(150, 120)); // subPanel大小,否则以一行形式往右延展
    panel.add(sub3);

    JPanel sub4 = new CheckBoxPanel();
    panel.add(sub4);
    JPanel sub5 = new RadioButtonPanel();
    panel.add(sub5);

    JFrame jframe = new JFrame("HelloWorld");
    jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    jframe.getContentPane().add(panel); // 自建类
    jframe.pack(); // 必备,否则无初始大小
    jframe.setVisible(true); // 必备,否则不可见
  }
Esempio n. 4
0
  /** Default constructor for the demo. */
  public IconDemoApp() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setTitle("Icon Demo: Please Select an Image");

    // A label for displaying the pictures
    photographLabel.setVerticalTextPosition(JLabel.BOTTOM);
    photographLabel.setHorizontalTextPosition(JLabel.CENTER);
    photographLabel.setHorizontalAlignment(JLabel.CENTER);
    photographLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    // We add two glue components. Later in process() we will add thumbnail buttons
    // to the toolbar inbetween thease glue compoents. This will center the
    // buttons in the toolbar.
    buttonBar.add(Box.createGlue());
    buttonBar.add(Box.createGlue());

    add(buttonBar, BorderLayout.SOUTH);
    add(photographLabel, BorderLayout.CENTER);

    setSize(400, 300);

    // this centers the frame on the screen
    setLocationRelativeTo(null);

    // start the image loading SwingWorker in a background thread
    loadimages.execute();
  }
Esempio n. 5
0
    public IndicatorToolbox() {
      super(JToolBar.HORIZONTAL);
      setOpaque(false);
      setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

      indicatorLabel = new JLabel(indicator.getLabel());
      indicatorLabel.setHorizontalTextPosition(SwingConstants.LEFT);
      indicatorLabel.setVerticalTextPosition(SwingConstants.CENTER);
      indicatorLabel.setOpaque(false);
      add(indicatorLabel);

      container = new JPanel();
      container.setOpaque(false);
      container.setLayout(new BoxLayout(container, BoxLayout.X_AXIS));
      add(container);
      update();

      addMouseListener(
          new MouseAdapter() {
            public @Override void mouseEntered(MouseEvent e) {
              mouseOver = true;
              validate();
              repaint();
            }

            public @Override void mouseExited(MouseEvent e) {
              setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
              mouseOver = false;
              validate();
              repaint();
            }
          });
    }
Esempio n. 6
0
  public LabelDemo() {
    super(new GridLayout(3, 1)); // 3 rows, 1 column
    JLabel label1, label2, label3;

    ImageIcon icon = createImageIcon("images/middle.gif", "a pretty but meaningless splat");

    // Create the first label.
    label1 = new JLabel("Image and Text", icon, JLabel.CENTER);
    // Set the position of its text, relative to its icon:
    label1.setVerticalTextPosition(JLabel.BOTTOM);
    label1.setHorizontalTextPosition(JLabel.CENTER);

    // Create the other labels.
    label2 = new JLabel("Text-Only Label");
    label3 = new JLabel(icon);

    // Create tool tips, for the heck of it.
    label1.setToolTipText("A label containing both image and text");
    label2.setToolTipText("A label containing only text");
    label3.setToolTipText("A label containing only an image");

    // Add the labels.
    add(label1);
    add(label2);
    add(label3);
  }
 public JLabel createLabel(String title, ImageIcon image, JPanel _p) {
   title = "<html><font size=\"-2\" face=\"Arial\"><center>" + title + "</center></font></html>";
   JLabel j = new JLabel(title, image, JLabel.CENTER);
   j.setVerticalTextPosition(JLabel.BOTTOM);
   j.setHorizontalTextPosition(JLabel.CENTER);
   _p.add(j);
   return j;
 }
 public UnsupportedVideo(String url) {
   JLabel label = new JLabel(UIResourceManager.getIcon(UIResourceManager.ICON_ERROR));
   label.setToolTipText("The video could not be loaded: " + url);
   label.setHorizontalTextPosition(JLabel.CENTER);
   label.setVerticalTextPosition(JLabel.VERTICAL);
   label.setSize(label.getPreferredSize());
   component = label;
 }
Esempio n. 9
0
 public void setLabels() {
   int currentRoomID = model.getPlayer().getCurrentRoomID();
   magic.setText(model.getRoom(currentRoomID).getMagicName());
   health.setText("Health = " + model.getPlayer().getHealth());
   magic.setVerticalTextPosition(JLabel.TOP);
   exp.setText("Experience = " + model.getPlayer().getExp());
   currentRoom.setText("Current Room ID = " + model.getPlayer().getCurrentRoomID());
   playerItemLabel.setText("Player's Items (Max " + model.getPlayer().getExp() + ")");
 }
Esempio n. 10
0
 public ChatStatePanel(ChatState state, String nickname) {
   setLayout(new FlowLayout(FlowLayout.LEFT, 1, 1));
   JLabel label = new JLabel(Res.getString(state.name(), nickname));
   label.setFont(new Font("Courier New", Font.PLAIN, 9));
   label.setForeground(Color.gray);
   label.setHorizontalTextPosition(JLabel.LEFT);
   label.setVerticalTextPosition(JLabel.BOTTOM);
   add(label);
 }
Esempio n. 11
0
 public JLabel label(String desc) {
   if (desc == null) {
     desc = "" + getGoodness();
   }
   JLabel l = new JLabel(desc, new ImageIcon(toImage()), SwingConstants.CENTER);
   l.setVerticalTextPosition(SwingConstants.BOTTOM);
   l.setHorizontalTextPosition(SwingConstants.CENTER);
   return l;
 }
Esempio n. 12
0
  public MovingPicture(String name) {
    JLabel label = new JLabel();
    ImageIcon icon = new ImageIcon("faces/" + name + "/profilePicture.jpg");
    label.setIcon(icon);
    label.setText("<html><h3>Hallo " + name + "</h3></html>");
    label.setHorizontalTextPosition(SwingConstants.CENTER);
    label.setVerticalTextPosition(SwingConstants.BOTTOM);
    add(label);
    pack();

    reset();
  }
Esempio n. 13
0
  public Newspaper() {
    // setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setTitle("Newspaper");
    getContentPane().setBackground(new Color(251, 236, 175));

    // A label for displaying the pictures
    photographLabel.setVerticalTextPosition(JLabel.BOTTOM);
    photographLabel.setHorizontalTextPosition(JLabel.CENTER);
    photographLabel.setHorizontalAlignment(JLabel.CENTER);
    photographLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    // A label for Displaying the news
    // theLabel.setVerticalTextPosition(JLabel.BOTTOM);
    // theLabel.setHorizontalTextPosition(JLabel.CENTER);
    // theLabel.setHorizontalAlignment(JLabel.CENTER);
    theLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    theLabel.setContentType("text/html");
    theLabel.setEditable(false);

    JScrollPane scrollPane = new JScrollPane(theLabel);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    // We add two glue components. Later in process() we will add thumbnail buttons
    // to the toolbar inbetween thease glue compoents. This will center the
    // buttons in the toolbar.
    buttonBar.add(Box.createGlue());
    buttonBar.add(Box.createGlue());
    buttonBar.setBackground(new Color(251, 236, 175));
    // buttonBar.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));

    add(buttonBar, BorderLayout.SOUTH);
    add(photographLabel, BorderLayout.NORTH);
    add(scrollPane, BorderLayout.CENTER);

    Icon header =
        createImageIcon(
            "Resources/Image/newspaper/header.gif", "Blackwood Times : Weekly Newspaper");
    photographLabel.setIcon(header);

    setSize(700, 525);

    // this centers the frame on the screen
    setLocationRelativeTo(null);

    // start the image loading SwingWorker in a background thread
    loadimages.execute();
  }
Esempio n. 14
0
  public JlabelDemo() {
    ImageIcon icon = new ImageIcon("java-swing-tutorial.JPG", "My Website");
    // Creating an Icon
    setLayout(new GridLayout(3, 1));
    // 3 rows, 1 column Panel having Grid Layout
    jlbLabel1 = new JLabel("Image with Text", icon, JLabel.CENTER);
    // We can position of the text, relative to the icon:
    jlbLabel1.setVerticalTextPosition(JLabel.BOTTOM);

    jlbLabel1.setHorizontalTextPosition(JLabel.CENTER);
    jlbLabel2 = new JLabel("Text Only Label");
    jlbLabel3 = new JLabel(icon); // Label of Icon Only
    // Add labels to the Panel
    add(jlbLabel1);
    add(jlbLabel2);
    add(jlbLabel3);
  }
Esempio n. 15
0
  private MainPanel() {
    super();

    JLabel label = new JLabel(new DragHereIcon());
    label.setText("<html>Drag <b>Files</b> Here");
    label.setVerticalTextPosition(SwingConstants.BOTTOM);
    label.setHorizontalTextPosition(SwingConstants.CENTER);
    label.setForeground(Color.GRAY);
    label.setFont(new Font(Font.SERIF, Font.PLAIN, 24));

    label.setDropTarget(
        new DropTarget(label, DnDConstants.ACTION_COPY, new FileDropTargetAdapter(), true));
    // Test: label.setTransferHandler(new FileTransferHandler());

    add(label);
    setPreferredSize(new Dimension(320, 240));
  }
Esempio n. 16
0
  public void setText(@Nullable final String... text) {
    myText.removeAll();
    if (text == null) return;

    for (int i = 0; i < text.length; i++) {
      final JLabel eachLabel = new JLabel(text[i], JLabel.CENTER);
      final int gap = eachLabel.getIconTextGap();
      eachLabel.setBorder(new EmptyBorder(0, 0, 0, gap));
      eachLabel.setVerticalTextPosition(JLabel.TOP);
      eachLabel.setFont(eachLabel.getFont().deriveFont(Font.BOLD, eachLabel.getFont().getSize()));
      myText.add(eachLabel);
      if (i < text.length - 1) {
        final JLabel eachIcon =
            new JLabel(IconLoader.getIcon("/general/comboArrowRight.png"), JLabel.CENTER);
        eachIcon.setBorder(new EmptyBorder(0, 0, 0, gap));
        myText.add(eachIcon);
      }
    }
  }
 @Override
 protected javax.swing.JLabel getListCellRendererComponent(
     javax.swing.JLabel rv,
     javax.swing.JList list,
     org.alice.stageide.modelresource.EnumConstantResourceKey value,
     int index,
     boolean isSelected,
     boolean cellHasFocus) {
   if (value != null) {
     rv.setText(value.getDisplayText());
     org.lgna.croquet.icon.IconFactory iconFactory = value.getIconFactory();
     rv.setIcon(
         iconFactory.getIcon(
             iconFactory.getDefaultSize(org.alice.ide.Theme.DEFAULT_LARGE_ICON_SIZE)));
     rv.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
     rv.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
     rv.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
   }
   return rv;
 }
  public Component getTableCellRendererComponent(
      JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {

    final JLabel label = new JLabel();
    label.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY, 1));
    label.setHorizontalTextPosition(SwingConstants.CENTER);
    label.setHorizontalAlignment(SwingConstants.CENTER);
    label.setVerticalAlignment(SwingConstants.CENTER);
    label.setVerticalTextPosition(SwingConstants.CENTER);

    if (value != null && value instanceof Icon) {
      label.setIcon((Icon) value);
    } else {

      label.setFont(ICON_FONT);
      label.setText("?");
    }

    return label;
  }
    public Component getListCellRendererComponent(
        final JList list,
        final Object value,
        final int index,
        final boolean isSelected,
        final boolean cellHasFocus) {
      final RoboticonFile roboticonFile = (RoboticonFile) value;

      JLabel label = new JLabel();
      label.setOpaque(true);
      label.setBorder(BorderFactory.createEmptyBorder());
      label.setHorizontalAlignment(JLabel.LEFT);
      label.setVerticalTextPosition(JLabel.CENTER);
      label.setFont(FONT);
      label.setEnabled(list.isEnabled());
      label.setForeground(isSelected ? list.getSelectionForeground() : list.getForeground());
      label.setBackground(isSelected ? list.getSelectionBackground() : list.getBackground());

      // BOLD text if sequence
      if (roboticonFile.roboticonType.equals(RoboticonType.SEQUENCE)) {
        label.setFont(BOLD_FONT);
      }
      String fileName = roboticonFile == null ? "unknown" : roboticonFile.getName();
      if (fileName.lastIndexOf('.') != -1) {
        fileName = fileName.substring(0, fileName.lastIndexOf('.'));
      }
      label.setText(fileName);
      String toolTip = null;
      if (roboticonFile != null) {
        toolTip = roboticonFile.senderId;
        if (toolTip.length() == 0) {
          toolTip = roboticonFile.getAbsolutePath();
        }
      }
      label.setToolTipText(toolTip);
      return label;
    }
Esempio n. 20
0
  public BiblioSearchLimitPanel(
      DatabankSchema schema, MarcQueryBuilder queryBuilder, int language, SearchUI utils) {
    super(new GridBagLayout(), queryBuilder);
    this.schema = schema;
    this.language = language;
    ButtonGroup g;

    props = PropertyUtils.loadProperties(getClass().getName(), LocaleUtils.getLocale(language));
    GuiUtils.setActionName(dateRangeAction, props.getProperty("date_range.name"));
    GuiUtils.setActionName(yearAction, props.getProperty("year.name"));
    this.utils = utils;

    lblCodingLevel = new JLabel(props.getProperty("coding_level.name"));
    cmCodingLevel = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_17);
    cmCodingLevel.setName("biblioCodingLevel");
    lblCodingLevel.setLabelFor(cmCodingLevel);

    lblCataloguingForm = new JLabel(props.getProperty("cataloguing_form.name"));
    cmCataloguingForm = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_18);
    cmCataloguingForm.setName("biblioCataloguingForm");
    lblCataloguingForm.setLabelFor(cmCataloguingForm);

    rBetween = new JRadioButton(props.getProperty("between.name"));
    rBetween.setName("biblioBetweenYears");
    rLt = new JRadioButton(props.getProperty("lt.name"));
    rLt.setName("biblioLessThanYear");
    rGt = new JRadioButton(props.getProperty("gt.name"));
    rGt.setName("biblioGreaterThanYear");
    txfYear = utils.queryTextField(4);
    txfYear.setName("biblioYearEquals");
    rYear = new JRadioButton(yearAction);
    rYear.setName("biblioYear");
    rDateRange = new JRadioButton(dateRangeAction);
    rDateRange.setName("biblioDateRange");
    lblDoctype = new JLabel(props.getProperty("biblio_doctype.name"));
    lblFrom = new JLabel(props.getProperty("from.name"));
    lblTo = new JLabel(props.getProperty("to.name"));
    lblLanguage = new JLabel(props.getProperty("language.name"));
    lblLocation = new JLabel(props.getProperty("location.name"));
    lblRetriveNo = new JLabel(props.getProperty("retriveNo.name"));
    lblRecType = new JLabel(props.getProperty("rectype.name"));
    lblRecStatus = new JLabel(props.getProperty("recstatus.name"));
    lblCalendar = new JLabel(props.getProperty("calendar.name"));
    lblBiblevel = new JLabel(props.getProperty("biblevel.name"));
    lblHierarchicalLevel = new JLabel(props.getProperty("hierarchical_level.name"));
    cmDoctype = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_DOC_TYPE);
    cmDoctype.setName("biblioDocType");
    cmLocation = utils.constantTableLookup(SearchEngineDocumentModel.LOCATION);
    cmLocation.setName("biblioLocation");
    cmLanguage = utils.constantTableLookup(SearchEngineDocumentModel.LANGUAGE);
    cmLanguage.setName("biblioLanguage");
    cmBiblevel = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_7);
    cmBiblevel.setName("biblioLevel");
    cmHierarchicalLevel = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_8);
    cmHierarchicalLevel.setName("biblioHierarchicalLevel");
    cmRecType = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_6);
    cmRecType.setName("biblioRecType");
    cmRecStatus = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_5);
    cmRecStatus.setName("biblioRecStatus");
    cmCalendar = utils.constantTableLookup(SearchEngineDocumentModel.CALENDAR);
    cmCalendar.setName("biblioCalendar");
    txfFrom = utils.queryTextField(10);
    txfFrom.setName("biblioFromYear");
    txfTo = utils.queryTextField(10);
    txfTo.setName("biblioToYear");
    txfRetriveNo = utils.queryTextField(10);
    txfRetriveNo.setName("retriveNo");
    lblDoctype.setLabelFor(cmDoctype);
    lblLocation.setLabelFor(cmLocation);
    lblLanguage.setLabelFor(cmLanguage);
    lblFrom.setLabelFor(txfFrom);
    lblTo.setLabelFor(txfTo);
    lblRetriveNo.setLabelFor(txfRetriveNo);
    lblTo.setVerticalTextPosition(JLabel.BOTTOM);
    lblCalendar.setHorizontalAlignment(JLabel.TRAILING);
    lblLanguage.setHorizontalAlignment(JLabel.TRAILING);
    lblRecType.setHorizontalAlignment(JLabel.TRAILING);
    lblDoctype.setHorizontalAlignment(JLabel.TRAILING);
    lblLocation.setHorizontalAlignment(JLabel.TRAILING);
    cbHasAttachment = new JCheckBox(props.getProperty("attachment.name"));
    cbIsOpenShelf = new JCheckBox(props.getProperty("openShelf.name"));
    cbIsLendable = new JCheckBox(props.getProperty("lendable.name"));
    rWithAttachment = new JRadioButton(props.getProperty("attachment-present.name"));
    rWithoutAttachment = new JRadioButton(props.getProperty("attachment-notpresent.name"));
    cbHasAttachment.setName("biblioAttachment");
    cbIsOpenShelf.setName("holdingIsOpenShelf");
    cbIsLendable.setName("holdingIsLendable");
    rWithAttachment.setName("biblioAttachmentPresent");
    rWithoutAttachment.setName("biblioAttachmentNotPresent");
    cbHasAttachment.addChangeListener(attachmentChangedListener);
    rWithAttachment.setEnabled(false);
    rWithoutAttachment.setEnabled(false);
    cbHasAttachment.setSelected(false);
    cbIsOpenShelf.setSelected(false);
    cbIsLendable.setSelected(false);
    g = new ButtonGroup();
    g.add(rWithAttachment);
    g.add(rWithoutAttachment);

    g = new ButtonGroup();
    g.add(rBetween);
    g.add(rLt);
    g.add(rGt);
    g = new ButtonGroup();
    g.add(rDateRange);
    g.add(rYear);
    rYear.setSelected(true);
    dateCriteriaChanged();

    lblDescriptionLevel = new JLabel(props.getProperty("level-of-description.name"));
    cmDescriptionLevel =
        utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_ISAD_LEVEL_OF_DESCRIPTION);
    cmDescriptionLevel.setName("biblioDescriptionLevel");
    lblDescriptionLevel.setLabelFor(cmDescriptionLevel);

    lblGMD = new JLabel(props.getProperty("general-material.name"));
    cmGMD = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_GMD_LIST);
    cmGMD.setName("biblioGMD");
    lblGMD.setLabelFor(cmGMD);

    lblLCClass = new JLabel(props.getProperty("lcclass.name"));
    txfLCClass = new JTextField(20);
    GuiUtils.localeSupport(txfLCClass);
    GuiUtils.setComponentOrientation(txfLCClass, ComponentOrientation.LEFT_TO_RIGHT);
    lblLCClass.setLabelFor(txfLCClass);

    LayoutFacility lf = new LayoutFacility(this);
    /*
            lf.add(lblCodingLevel,
                    new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0));
            lf.add(cmCodingLevel,
                    new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
    */
    int y = 0;
    lf.add(
        lblDoctype,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmDoctype,
        new GridBagConstraints(
            1,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblRecType,
        new GridBagConstraints(
            2,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_END,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmRecType,
        new GridBagConstraints(
            3,
            y++,
            GridBagConstraints.REMAINDER,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblGMD,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_END,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmGMD,
        new GridBagConstraints(
            1,
            y++,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    lf.add(
        lblLocation,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmLocation,
        new GridBagConstraints(
            1,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblLanguage,
        new GridBagConstraints(
            2,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmLanguage,
        new GridBagConstraints(
            3,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblBiblevel,
        new GridBagConstraints(
            4,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmBiblevel,
        new GridBagConstraints(
            5,
            y++,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    ////
    lf.add(
        lblCataloguingForm,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmCataloguingForm,
        new GridBagConstraints(
            1,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblHierarchicalLevel,
        new GridBagConstraints(
            2,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmHierarchicalLevel,
        new GridBagConstraints(
            3,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblRecStatus,
        new GridBagConstraints(
            4,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmRecStatus,
        new GridBagConstraints(
            5,
            y++,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    ////
    lf.add(
        lblCodingLevel,
        new GridBagConstraints(
            4,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmCodingLevel,
        new GridBagConstraints(
            5,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        rYear,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        txfYear,
        new GridBagConstraints(
            1,
            y,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblCalendar,
        new GridBagConstraints(
            2,
            y,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmCalendar,
        new GridBagConstraints(
            3,
            y++,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    lf.add(
        rDateRange,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    LayoutFacility datelf = new LayoutFacility(new JPanel());
    datelf.add(
        lblFrom,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 5, 2, 5),
            0,
            0));
    datelf.add(
        txfFrom,
        new GridBagConstraints(
            2,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    datelf.add(
        rGt,
        new GridBagConstraints(
            3,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    datelf.add(
        rBetween,
        new GridBagConstraints(
            4,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    datelf.add(
        rLt,
        new GridBagConstraints(
            5,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    datelf.add(
        lblTo,
        new GridBagConstraints(
            6,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 5, 2, 5),
            0,
            0));
    datelf.add(
        txfTo,
        new GridBagConstraints(
            7,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    datelf.add(
        Box.createHorizontalGlue(),
        new GridBagConstraints(
            8,
            1,
            GridBagConstraints.REMAINDER,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_END,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    lf.add(
        datelf.container,
        new GridBagConstraints(
            1,
            y++,
            GridBagConstraints.REMAINDER,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    LayoutFacility lcClasslf = new LayoutFacility(new JPanel());
    lcClasslf.add(
        lblLCClass,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 5, 2, 5),
            0,
            0));
    lcClasslf.add(
        txfLCClass,
        new GridBagConstraints(
            2,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    lf.add(
        lcClasslf.container,
        new GridBagConstraints(
            0,
            y++,
            2,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    LayoutFacility attLf = LayoutFacility.createLayoutFacility();
    int x = 0;
    attLf.add(
        cbHasAttachment,
        new GridBagConstraints(
            x++,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    attLf.add(
        cbIsOpenShelf,
        new GridBagConstraints(
            x++,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    //        attLf.add(cbIsLendable,
    //        		new GridBagConstraints(x++, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START,
    // GridBagConstraints.NONE, new Insets(2, 2, 2, 10), 0, 0));
    attLf.add(
        lblRetriveNo,
        new GridBagConstraints(
            x++,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 20, 2, 2),
            0,
            0));
    attLf.add(
        txfRetriveNo,
        new GridBagConstraints(
            x++,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            25,
            0));

    if (SystemUtils.isISADAvailable()) {
      attLf.add(
          lblDescriptionLevel,
          new GridBagConstraints(
              x++,
              0,
              1,
              1,
              0.0,
              0.0,
              GridBagConstraints.LINE_START,
              GridBagConstraints.HORIZONTAL,
              new Insets(2, 20, 2, 2),
              0,
              0));
      attLf.add(
          cmDescriptionLevel,
          new GridBagConstraints(
              x++,
              0,
              1,
              1,
              0.0,
              0.0,
              GridBagConstraints.LINE_START,
              GridBagConstraints.NONE,
              new Insets(2, 2, 2, 2),
              0,
              0));
    }

    /*
            attLf.add(rWithAttachment,
                    new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
            attLf.add(rWithoutAttachment,
                    new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
    */

    lf.add(
        attLf.container,
        new GridBagConstraints(
            0,
            y,
            GridBagConstraints.REMAINDER,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    //        lf.add(Box.createHorizontalGlue(),
    //                new GridBagConstraints(1, 4, 0, 1, 0.0, 0.0, GridBagConstraints.LINE_START,
    // GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0));

    ChangeListener limitChangeListener =
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            txfFrom.setEditable(!rLt.isSelected() && rDateRange.isSelected());
            txfTo.setEditable(!rGt.isSelected() && rDateRange.isSelected());
          }
        };
    rGt.addChangeListener(limitChangeListener);
    rLt.addChangeListener(limitChangeListener);
    rBetween.addChangeListener(limitChangeListener);
    rGt.setSelected(true);
  }
Esempio n. 21
0
  private JPanel viewMarketingPanel(final JPanel mainPanel) {
    // removes everything from the main layout
    mainPanel.setLayout(new BorderLayout());
    JPanel mainmarketPanel = new JPanel();
    mainmarketPanel.setLayout(new BoxLayout(mainmarketPanel, BoxLayout.Y_AXIS));
    JPanel headerPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    headerPanel.setPreferredSize(new Dimension(600, 60));
    JLabel header = new JLabel("MARKETING NOTE");
    header.setFont(new Font("Verdana", Font.BOLD, 25));
    headerPanel.add(header);
    mainmarketPanel.add(headerPanel);

    for (int i = 0; i < numOfSelected.length; ++i) {
      int ID = numOfSelected[i];
      JPanel marketPanel = new JPanel();
      BorderLayout marketNoteLayout = new BorderLayout();
      marketNoteLayout.setVgap(10);
      marketPanel.setLayout(marketNoteLayout);

      JLabel noteDateLabel = new JLabel("Note Date: ");
      noteDateLabel.setFont(new Font("Tahoma", Font.BOLD, 20));
      JLabel noteDate = new JLabel(getNoteDate(2, ID));
      noteDate.setFont(new Font("Tahoma", Font.PLAIN, 20));
      JLabel machineIDLabel = new JLabel("Machine ID: ");
      machineIDLabel.setFont(new Font("Tahoma", Font.BOLD, 20));
      JLabel machineID = new JLabel(String.valueOf(ID + 1));
      machineID.setVerticalTextPosition(SwingConstants.BOTTOM);
      machineID.setFont(new Font("Tahoma", Font.PLAIN, 20));

      JPanel dateFlow = new JPanel(new FlowLayout());
      JPanel idFlow = new JPanel(new FlowLayout());
      JPanel dateIdGrid = new JPanel(new GridLayout(1, 2));

      dateFlow.add(noteDateLabel);
      dateFlow.add(noteDate);
      idFlow.add(machineIDLabel);
      idFlow.add(machineID);

      dateIdGrid.add(dateFlow);
      dateIdGrid.add(idFlow);

      // topFlow.add(topGrid);
      JPanel notePanel = new JPanel(new FlowLayout());
      JLabel noteLabel = new JLabel("Note:  ");
      noteLabel.setFont(new Font("Tahoma", Font.BOLD, 20));
      noteLabel.setPreferredSize(new Dimension(600, 30));
      notePanel.add(noteLabel);
      final JTextArea marketerNote = new JTextArea(getMarketingNote(ID));
      marketerNote.setFont(new Font("Arial", Font.PLAIN, 14));
      marketerNote.setEditable(false);
      marketerNote.setPreferredSize(new Dimension(600, 200));
      JScrollPane scrollText = new JScrollPane(marketerNote);
      JPanel scrollPanel = new JPanel(new FlowLayout());
      scrollPanel.add(scrollText);

      // panels for marketer note

      JPanel reNoteFlow = new JPanel(new BorderLayout(0, 20));
      // adds to the flow layouts for centering

      reNoteFlow.add(notePanel, BorderLayout.NORTH);
      reNoteFlow.add(scrollPanel, BorderLayout.CENTER);
      // adds to the main layout
      marketPanel.add(dateIdGrid, BorderLayout.NORTH);
      marketPanel.add(reNoteFlow, BorderLayout.CENTER);
      // marketPanel.setPreferredSize(new Dimension(400, 400));
      mainmarketPanel.add(marketPanel);
      // mainmarketPanel.add(Box.createVerticalGlue());
    }
    JScrollPane sPane = new JScrollPane(mainmarketPanel);
    mainPanel.add(sPane, BorderLayout.CENTER);
    // JPanel buttonPanel = new JPanel(new FlowLayout());
    JButton backButton = new JButton("Back");
    backButton.setPreferredSize(new Dimension(10, 50));
    backButton.setFont(new Font("Arial", Font.PLAIN, 18));
    // buttonPanel.add(backButton);
    mainPanel.add(backButton, BorderLayout.SOUTH);

    backButton.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            mainPanel.removeAll();
            // mainmarketPanel.setLayout( new GridLayout());
            localVendMarketingPanel(mainPanel);
            mainPanel.revalidate();
            mainPanel.repaint();
          }
        });
    return mainPanel;
  }
 /**
  * Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR
  * call it in your code!
  *
  * @noinspection ALL
  */
 private void $$$setupUI$$$() {
   panelMain = new JPanel();
   panelMain.setLayout(new GridLayoutManager(4, 4, new Insets(0, 0, 0, 0), -1, -1));
   final Spacer spacer1 = new Spacer();
   panelMain.add(
       spacer1,
       new GridConstraints(
           1,
           3,
           2,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_VERTICAL,
           1,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           null,
           null,
           null,
           0,
           false));
   final JLabel label1 = new JLabel();
   this.$$$loadLabelText$$$(
       label1,
       ResourceBundle.getBundle("viewer").getString("hdm_account_cold_address_list_label"));
   panelMain.add(
       label1,
       new GridConstraints(
           1,
           1,
           1,
           1,
           GridConstraints.ANCHOR_WEST,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           null,
           null,
           null,
           0,
           false));
   final Spacer spacer2 = new Spacer();
   panelMain.add(
       spacer2,
       new GridConstraints(
           1,
           2,
           2,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           1,
           null,
           null,
           null,
           0,
           false));
   final Spacer spacer3 = new Spacer();
   panelMain.add(
       spacer3,
       new GridConstraints(
           2,
           1,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_VERTICAL,
           1,
           GridConstraints.SIZEPOLICY_FIXED,
           new Dimension(-1, 10),
           new Dimension(-1, 10),
           new Dimension(-1, 10),
           0,
           false));
   final Spacer spacer4 = new Spacer();
   panelMain.add(
       spacer4,
       new GridConstraints(
           0,
           1,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_VERTICAL,
           1,
           GridConstraints.SIZEPOLICY_FIXED,
           new Dimension(-1, 10),
           new Dimension(-1, 10),
           new Dimension(-1, 10),
           0,
           false));
   final Spacer spacer5 = new Spacer();
   panelMain.add(
       spacer5,
       new GridConstraints(
           1,
           0,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_FIXED,
           1,
           new Dimension(10, -1),
           new Dimension(10, -1),
           new Dimension(10, -1),
           0,
           false));
   pnlBottom = new JPanel();
   pnlBottom.setLayout(new GridLayoutManager(1, 4, new Insets(0, 0, 0, 0), -1, -1));
   panelMain.add(
       pnlBottom,
       new GridConstraints(
           3,
           0,
           1,
           3,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_BOTH,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
           null,
           null,
           null,
           0,
           false));
   lblType = new JLabel();
   lblType.setBackground(new Color(-1));
   lblType.setHorizontalAlignment(0);
   lblType.setHorizontalTextPosition(0);
   lblType.setIcon(new ImageIcon(getClass().getResource("/images/address_type_private.png")));
   lblType.setText("");
   lblType.setVerticalAlignment(0);
   lblType.setVerticalTextPosition(1);
   pnlBottom.add(
       lblType,
       new GridConstraints(
           0,
           2,
           1,
           1,
           GridConstraints.ANCHOR_EAST,
           GridConstraints.FILL_NONE,
           GridConstraints.SIZEPOLICY_FIXED,
           GridConstraints.SIZEPOLICY_FIXED,
           new Dimension(20, 30),
           new Dimension(20, 30),
           new Dimension(20, 30),
           0,
           false));
   final Spacer spacer6 = new Spacer();
   pnlBottom.add(
       spacer6,
       new GridConstraints(
           0,
           3,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_FIXED,
           1,
           new Dimension(10, -1),
           new Dimension(10, -1),
           new Dimension(10, -1),
           0,
           false));
   final Spacer spacer7 = new Spacer();
   pnlBottom.add(
       spacer7,
       new GridConstraints(
           0,
           1,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_WANT_GROW,
           1,
           null,
           null,
           null,
           0,
           false));
   final Spacer spacer8 = new Spacer();
   pnlBottom.add(
       spacer8,
       new GridConstraints(
           0,
           0,
           1,
           1,
           GridConstraints.ANCHOR_CENTER,
           GridConstraints.FILL_HORIZONTAL,
           GridConstraints.SIZEPOLICY_FIXED,
           1,
           new Dimension(10, -1),
           new Dimension(10, -1),
           new Dimension(10, -1),
           0,
           false));
 }
Esempio n. 23
0
  private JPanel editMarketingPanel(final JPanel marketPanel, int ID) {

    BorderLayout marketNoteLayout = new BorderLayout();
    marketNoteLayout.setVgap(10);
    marketPanel.setLayout(marketNoteLayout);

    JLabel noteDateLabel = new JLabel("Note Date: ");
    noteDateLabel.setFont(new Font("Tahoma", Font.BOLD, 20));
    final JLabel noteDate = new JLabel(getNoteDate(2, ID));
    noteDate.setFont(new Font("Tahoma", Font.PLAIN, 20));
    JLabel machineIDLabel = new JLabel("Machine ID: ");
    machineIDLabel.setFont(new Font("Tahoma", Font.BOLD, 20));
    JLabel machineID = new JLabel(String.valueOf(ID + 1));
    machineID.setVerticalTextPosition(SwingConstants.BOTTOM);
    machineID.setFont(new Font("Tahoma", Font.PLAIN, 20));

    JLabel header = new JLabel("MARKETING NOTE");
    header.setFont(new Font("Verdana", Font.BOLD, 25));
    header.setHorizontalAlignment(SwingConstants.CENTER);
    JPanel topGrid = new JPanel(new GridLayout(2, 1));
    JPanel dateFlow = new JPanel(new FlowLayout());
    JPanel idFlow = new JPanel(new FlowLayout());
    JPanel dateIdGrid = new JPanel(new GridLayout(1, 2));

    dateFlow.add(noteDateLabel);
    dateFlow.add(noteDate);
    idFlow.add(machineIDLabel);
    idFlow.add(machineID);

    topGrid.add(header);
    dateIdGrid.add(dateFlow);
    dateIdGrid.add(idFlow);
    topGrid.add(dateIdGrid);

    // topFlow.add(topGrid);

    // text field for the restocker note
    JLabel noteLabel = new JLabel("Note:  ");
    noteLabel.setFont(new Font("Tahoma", Font.BOLD, 20));

    final JTextArea marketNote = new JTextArea(getMarketingNote(numOfSelected[0]));

    marketNote.setFont(new Font("Arial", Font.PLAIN, 14));
    JScrollPane scrollText = new JScrollPane(marketNote);
    // buttons for the restocker note interface
    final JButton save = new JButton("Save Note");
    final JButton back = new JButton("Back");
    final JLabel info = new JLabel("No changes made");

    info.setVisible(true);

    save.setEnabled(false);

    // panels for restocker note
    JPanel buttonFlow = new JPanel(new FlowLayout());

    JPanel reNoteFlow = new JPanel(new BorderLayout(0, 20));
    // adds to the flow layouts for centering
    buttonFlow.add(save);
    buttonFlow.add(info);
    buttonFlow.add(back);
    reNoteFlow.add(noteLabel, BorderLayout.NORTH);
    reNoteFlow.add(scrollText, BorderLayout.CENTER);
    // adds to the main layout
    marketPanel.add(topGrid, BorderLayout.NORTH);
    marketPanel.add(reNoteFlow, BorderLayout.CENTER);
    marketPanel.add(buttonFlow, BorderLayout.SOUTH);

    marketNote.addCaretListener(
        new CaretListener() {

          @Override
          public void caretUpdate(CaretEvent e) {

            String databaseText = getDatabaseText(marketNote.getText());
            // System.out.println(databaseText);
            if (databaseText.equals(getMarketingNote(numOfSelected[0]))) {
              save.setEnabled(false);
              info.setText("No changes made");
            } else {
              save.setEnabled(true);
              info.setText("You need to save your changes");
            }
          }
        });

    back.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            marketPanel.removeAll();
            localVendMarketingPanel(marketPanel);
            marketPanel.revalidate();
            marketPanel.repaint();
          }
        });
    save.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {
            try {

              changeMarketingNote(marketNote.getText());
              noteDate.setText(getNoteDate(2, numOfSelected[0]));
              marketNote.setText(getMarketingNote(numOfSelected[0]));
              info.setText("Changes Saved");

            } catch (NegativeInputException | NullDateException e) {
              System.err.println("Error. Changing Marketing Note Failed.");
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
          }
        });

    return marketPanel;
  }
Esempio n. 24
0
  public WelcomeDialog(Object[] options) {
    setUndecorated(true);
    setModal(true);

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.setBackground(Color.WHITE);
    Icon welcome = new javax.swing.ImageIcon(ProjectFrame.class.getResource("/frinika.png"));
    JLabel label = new JLabel(welcome);
    label.setHorizontalTextPosition(SwingConstants.CENTER);
    label.setVerticalTextPosition(SwingConstants.BOTTOM);
    label.setFont(label.getFont().deriveFont(Font.PLAIN));
    label.setText(AboutDialog.MAIN_TITLE);
    label.setBorder(BorderFactory.createEmptyBorder(25, 5, 5, 5));
    panel.add(label, BorderLayout.NORTH);
    panel.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));

    JPanel contentpane = new JPanel();
    contentpane.setBorder(BorderFactory.createLineBorder(Color.BLACK, 2));
    contentpane.setLayout(new BorderLayout());
    contentpane.add(panel);
    setContentPane(contentpane);

    JPanel buttonpanel = new JPanel();
    buttonpanel.setOpaque(false);
    for (int i = 0; i < options.length; i++) {
      ix = i;
      JButton button = new JButton(options[i].toString());
      button.addActionListener(
          new ActionListener() {
            int index = ix;

            public void actionPerformed(ActionEvent e) {

              ActionListener listener = listeners.get(index);
              if (listener != null) {
                listener.actionPerformed(e);
                return;
              }

              sel = index;
              setVisible(false);
            }
          });
      if (i == 0) {
        button.setDefaultCapable(true);
        getRootPane().setDefaultButton(button);
      }

      buttonpanel.add(button);
    }
    panel.add(buttonpanel, BorderLayout.CENTER);

    JPanel copyrightpanel = new JPanel();
    copyrightpanel.setOpaque(false);

    JLabel line = new JLabel(AboutDialog.COPYRIGHT_NOTICE);
    line.setHorizontalTextPosition(SwingConstants.CENTER);
    line.setFont(line.getFont().deriveFont(10f).deriveFont(Font.PLAIN));

    copyrightpanel.add(line);

    panel.add(copyrightpanel, BorderLayout.SOUTH);

    setTitle("Welcome");

    KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
    panel.registerKeyboardAction(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            sel = -1;
            setVisible(false);
          }
        },
        stroke,
        JComponent.WHEN_IN_FOCUSED_WINDOW);

    pack();

    Rectangle windowSize;
    Insets windowInsets;

    Toolkit toolkit = Toolkit.getDefaultToolkit();
    GraphicsEnvironment ge = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration();
    if (gc == null) gc = getGraphicsConfiguration();

    if (gc != null) {
      windowSize = gc.getBounds();
    } else {
      windowSize = new java.awt.Rectangle(toolkit.getScreenSize());
    }

    Dimension size = getSize();
    Point parent_loc = getLocation();
    setLocation(
        parent_loc.x + windowSize.width / 2 - (size.width / 2),
        parent_loc.y + windowSize.height / 2 - (size.height / 2));
  }
  public IEHyperlinkWidgetView(
      IEController ieController,
      IEHyperlinkWidget model,
      boolean addDnDSupport,
      IEWOComponentView view) {
    super(ieController, model, addDnDSupport, view);
    project = model.getProject();
    _jLabel =
        new JLabel(getModel().getValue()) {
          /**
           * Overrides paint
           *
           * @see javax.swing.JComponent#paint(java.awt.Graphics)
           */
          @Override
          public void paint(Graphics g) {
            super.paint(g);
            if (getModel().isCustomButton()) {
              Rectangle bounds = getBounds();
              g.setColor(getBackgroundColor());
              g.fillRect(0, 0, ROUNDED_BORDER_SIZE, ROUNDED_BORDER_SIZE);
              g.fillRect(
                  0, bounds.height - ROUNDED_BORDER_SIZE, ROUNDED_BORDER_SIZE, ROUNDED_BORDER_SIZE);
              g.fillRect(
                  bounds.width - ROUNDED_BORDER_SIZE, 0, ROUNDED_BORDER_SIZE, ROUNDED_BORDER_SIZE);
              g.fillRect(
                  bounds.width - ROUNDED_BORDER_SIZE,
                  bounds.height - ROUNDED_BORDER_SIZE,
                  ROUNDED_BORDER_SIZE,
                  ROUNDED_BORDER_SIZE);
            }
          }

          /**
           * Overrides getPreferredSize
           *
           * @see javax.swing.JComponent#getPreferredSize()
           */
          @Override
          public Dimension getPreferredSize() {
            if (getModel().isCustomButton()) {
              String s = getModel().getValue();
              if (s == null) {
                return new Dimension(30, 15);
              } else {
                return new Dimension(
                    (int)
                        (getFontMetrics(getFont()).getStringBounds(s, getGraphics()).getWidth()
                            + 32),
                    15);
              }
            } else {
              return super.getPreferredSize();
            }
          }
        };
    project.addObserver(this);
    performLabelTransformation();
    _jLabel.setMinimumSize(new Dimension(30, 15));
    _jLabel.setVerticalTextPosition(SwingConstants.CENTER);
    _jLabel.setHorizontalAlignment(SwingConstants.CENTER);
    TransparentMouseListener tml = new TransparentMouseListener(_jLabel, this);
    _jLabel.addMouseListener(tml);
    _jLabel.addMouseMotionListener(tml);
    add(_jLabel);
    setOpaque(false);
    validate();
  }
  private void makeAndSetTabComponents() {
    final String[] tabTitles = {"Libraries", "Modes", "Tools", "Examples", "Updates"};
    tabLabels = new JLabel[4];

    for (int i = 0; i < 4; i++) {
      final int temp = i;
      tabLabels[i] =
          new JLabel(tabTitles[i]) {
            @Override
            protected void paintComponent(Graphics g) {
              g.setClip(
                  Toolkit.createRoundRect(
                      0, 0, getWidth(), getHeight(), temp == 0 ? 6 : 0, temp == 3 ? 6 : 0, 0, 0));
              super.paintComponent(g);
            }
          };
      tabLabels[i].setForeground(Color.WHITE);
      tabLabels[i].setBackground(new Color(0x2d4251));
      tabLabels[i].setOpaque(true);
      tabLabels[i].setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
      tabLabels[i].setPreferredSize(new Dimension(TAB_WIDTH, TAB_HEIGHT));
      tabLabels[i].setHorizontalAlignment(SwingConstants.CENTER);
      tabLabels[i].setFont(Toolkit.getSansFont(14, Font.BOLD));
      tabbedPane.setTabComponentAt(i, tabLabels[i]);
    }

    updateTabPanel =
        new JPanel() {
          @Override
          protected void paintComponent(Graphics g) {
            g.setClip(Toolkit.createRoundRect(0, 0, getWidth(), getHeight(), 6, 6, 0, 0));
            super.paintComponent(g);
          }
        };
    ;
    updateTabLabel = new JLabel("Updates");
    updateTabLabel.setFont(Toolkit.getSansFont(14, Font.BOLD));
    numberLabel.setVerticalTextPosition(SwingConstants.CENTER);
    numberLabel.setHorizontalTextPosition(SwingConstants.CENTER);
    numberLabel.setFont(Toolkit.getSansFont(14, Font.BOLD));
    numberLabel.setForeground(Color.WHITE);
    updateTabPanel.setOpaque(true);
    updateTabPanel.setBackground(new Color(0x2d4251));
    updateTabLabel.setForeground(Color.WHITE);
    updateTabPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
    updateTabPanel.setPreferredSize(new Dimension(TAB_WIDTH, TAB_HEIGHT));
    tabbedPane.setTabComponentAt(4, updateTabPanel);

    GroupLayout tabLayout = new GroupLayout(updateTabPanel);
    tabLayout.setAutoCreateGaps(true);
    updateTabPanel.setLayout(tabLayout);
    tabLayout.setHorizontalGroup(
        tabLayout
            .createSequentialGroup()
            .addPreferredGap(
                LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
            .addComponent(updateTabLabel)
            .addComponent(numberLabel)
            .addPreferredGap(
                LayoutStyle.ComponentPlacement.RELATED,
                GroupLayout.PREFERRED_SIZE,
                Short.MAX_VALUE));
    tabLayout.setVerticalGroup(
        tabLayout
            .createParallelGroup(GroupLayout.Alignment.CENTER)
            .addComponent(numberLabel)
            .addComponent(updateTabLabel));

    numberLabel.setVisible(false);
  }
Esempio n. 27
0
  public void createComponents(Container pane) {
    // Create the task dialog but don't display it.
    _taskDialog = new TaskDialog();

    // Display all existing tasks in a table.
    _taskTable = new TaskTable();

    // Create scrollable text window to display messages.
    _taskMessages = new TaskMessages(1);

    // Add a slider for setting the allowed message level.
    _levelSlider = new JSlider(SwingConstants.HORIZONTAL, 0, 5, 1);
    _levelSlider.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e) {
            JSlider slider = (JSlider) e.getSource();
            TaskController control = new TaskController();
            Map<String, Object> args = new HashMap<String, Object>();

            args.put("level", new Integer(slider.getValue()));
            control.postMessage("Message GUI", "Set Level", args);

            return;
          }
        });
    _levelSlider.setMajorTickSpacing(1);
    _levelSlider.setPaintTicks(true);
    _levelSlider.setPaintLabels(true);
    _levelSlider.setSnapToTicks(true);
    // _levelSlider.setMinimumSize(new Dimension(90, 50));

    _levelLabel = new JLabel("Message Level: ");
    _levelLabel.setLabelFor(_levelSlider);
    _levelLabel.setVerticalTextPosition(SwingConstants.CENTER);
    _levelLabel.setHorizontalTextPosition(SwingConstants.RIGHT);

    // There are two buttons: "Create Task..." and "Quit".
    // The first button makes visible the task dialog, the
    // seconds stops the demo.
    _createButton = new JButton("Create Task...");
    _createButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            _taskDialog.activate();
          }
        });
    _createButton.setEnabled(true);

    _quitButton = new JButton("Quit");
    _quitButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            TaskController control = new TaskController();
            Map<String, Object> args = new HashMap<String, Object>();

            args.put("Exit Code", new Integer(0));
            control.postMessage("Task Manager", "Shutdown", args);
          }
        });
    _quitButton.setEnabled(true);

    // Layout the components.
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints gridConstraints = new GridBagConstraints();
    pane.setLayout(gridbag);

    // Put table's scrollable pane inside this pane.
    gridConstraints.anchor = GridBagConstraints.NORTH;
    gridConstraints.gridx = 0;
    gridConstraints.gridy = 0;
    gridConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridConstraints.gridheight = 1;
    gridbag.setConstraints(_taskTable.getComponents(), gridConstraints);
    pane.add(_taskTable.getComponents());

    // Put the message display up.
    gridConstraints.anchor = GridBagConstraints.NORTH;
    gridConstraints.gridx = 0;
    gridConstraints.gridy = 1;
    gridConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridConstraints.gridheight = 1;
    gridbag.setConstraints(_taskMessages.getComponents(), gridConstraints);
    pane.add(_taskMessages.getComponents());

    // Put the slider and label up.
    gridConstraints.anchor = GridBagConstraints.NORTH;
    gridConstraints.gridx = 0;
    gridConstraints.gridy = 2;
    gridConstraints.gridwidth = 1;
    gridConstraints.gridheight = 1;
    gridbag.setConstraints(_levelLabel, gridConstraints);
    pane.add(_levelLabel);

    gridConstraints.anchor = GridBagConstraints.NORTH;
    gridConstraints.gridx = 1;
    gridConstraints.gridy = 2;
    gridConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridConstraints.gridheight = 1;
    gridbag.setConstraints(_levelSlider, gridConstraints);
    pane.add(_levelSlider);

    // Put the buttons up.
    gridConstraints.anchor = GridBagConstraints.NORTH;
    gridConstraints.gridx = 2;
    gridConstraints.gridy = 3;
    gridConstraints.gridwidth = 1;
    gridbag.setConstraints(_createButton, gridConstraints);
    pane.add(_createButton);

    gridConstraints.gridx = 4;
    gridConstraints.gridy = 3;
    gridbag.setConstraints(_quitButton, gridConstraints);
    pane.add(_quitButton);

    return;
  }
Esempio n. 28
0
  private JPanel localVendRestockerPanel() {
    // removes everything from the main layout
    JPanel mainRestockPanel = new JPanel();
    mainRestockPanel.setLayout(new BoxLayout(mainRestockPanel, BoxLayout.Y_AXIS));
    JPanel headerPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    headerPanel.setPreferredSize(new Dimension(600, 60));
    JLabel header = new JLabel("RESTOCKER NOTE");
    header.setFont(new Font("Verdana", Font.BOLD, 25));
    headerPanel.add(header);
    mainRestockPanel.add(headerPanel);

    for (int i = 0; i < numOfSelected.length; ++i) {
      int ID = numOfSelected[i];
      JPanel restockPanel = new JPanel();
      BorderLayout restockNoteLayout = new BorderLayout();
      restockNoteLayout.setVgap(10);
      restockPanel.setLayout(restockNoteLayout);

      JLabel noteDateLabel = new JLabel("Note Date: ");
      noteDateLabel.setFont(new Font("Tahoma", Font.BOLD, 20));
      JLabel noteDate = new JLabel(getNoteDate(1, ID));
      noteDate.setFont(new Font("Tahoma", Font.PLAIN, 20));
      JLabel machineIDLabel = new JLabel("Machine ID: ");
      machineIDLabel.setFont(new Font("Tahoma", Font.BOLD, 20));
      JLabel machineID = new JLabel(String.valueOf(ID + 1));
      machineID.setVerticalTextPosition(SwingConstants.BOTTOM);
      machineID.setFont(new Font("Tahoma", Font.PLAIN, 20));

      JPanel dateFlow = new JPanel(new FlowLayout());
      JPanel idFlow = new JPanel(new FlowLayout());
      JPanel dateIdGrid = new JPanel(new GridLayout(1, 2));

      dateFlow.add(noteDateLabel);
      dateFlow.add(noteDate);
      idFlow.add(machineIDLabel);
      idFlow.add(machineID);

      dateIdGrid.add(dateFlow);
      dateIdGrid.add(idFlow);

      // topFlow.add(topGrid);
      JPanel notePanel = new JPanel(new FlowLayout());
      JLabel noteLabel = new JLabel("Note:  ");
      noteLabel.setFont(new Font("Tahoma", Font.BOLD, 20));
      noteLabel.setPreferredSize(new Dimension(600, 30));
      notePanel.add(noteLabel);
      final JTextArea restockerNote = new JTextArea(getRestockerNote(ID));
      restockerNote.setFont(new Font("Arial", Font.PLAIN, 14));
      restockerNote.setEditable(false);
      restockerNote.setPreferredSize(new Dimension(600, 200));
      JScrollPane scrollText = new JScrollPane(restockerNote);
      JPanel scrollPanel = new JPanel(new FlowLayout());
      scrollPanel.add(scrollText);

      // panels for restocker note

      JPanel reNoteFlow = new JPanel(new BorderLayout(0, 20));
      // adds to the flow layouts for centering

      reNoteFlow.add(notePanel, BorderLayout.NORTH);
      reNoteFlow.add(scrollPanel, BorderLayout.CENTER);
      // adds to the main layout
      restockPanel.add(dateIdGrid, BorderLayout.NORTH);
      restockPanel.add(reNoteFlow, BorderLayout.CENTER);
      restockPanel.setPreferredSize(new Dimension(400, 400));
      mainRestockPanel.add(restockPanel);
      mainRestockPanel.add(Box.createVerticalGlue());
    }

    return mainRestockPanel;
  }
Esempio n. 29
0
  /** Initializes the GUI. Auto-generated code - any changes you make will disappear. */
  public void initGUI() {
    try {
      preInitGUI();

      containerTabbedPane = new JTabbedPane();
      tbDirectedGraph = new JPanel();
      btnFilterDirectedGraph = new JButton();
      dirVertexDegreePanel = new JPanel();
      lblMinInDegree = new JLabel();
      lblMaxInDegree = new JLabel();
      lblMinOutDegree = new JLabel();
      lblMaxOutDegree = new JLabel();
      tfInDegreeMin = new JTextField();
      tfInDegreeMax = new JTextField();
      tfOutDegreeMin = new JTextField();
      tfOutDegreeMax = new JTextField();
      lblIinstructions = new JLabel();
      tbUndirectedGraph = new JPanel();
      unDirVertexDegreePanel = new JPanel();
      lblMinDegree = new JLabel();
      lblMaxDegree = new JLabel();
      tfMinDegree = new JTextField();
      tfMaxDegree = new JTextField();
      lblInstructionsDir = new JLabel();
      btnFilterUndirectedGraph = new JButton();

      BorderLayout thisLayout = new BorderLayout();
      this.getContentPane().setLayout(thisLayout);
      thisLayout.setHgap(0);
      thisLayout.setVgap(0);
      this.setTitle("Pruning");
      this.setSize(new java.awt.Dimension(316, 267));

      containerTabbedPane.setPreferredSize(new java.awt.Dimension(309, 265));
      this.getContentPane().add(containerTabbedPane, BorderLayout.CENTER);

      GridBagLayout tbDirectedGraphLayout = new GridBagLayout();
      tbDirectedGraph.setLayout(tbDirectedGraphLayout);
      tbDirectedGraphLayout.columnWidths = new int[] {1};
      tbDirectedGraphLayout.rowHeights = new int[] {1, 1, 1};
      tbDirectedGraphLayout.columnWeights = new double[] {0.1};
      tbDirectedGraphLayout.rowWeights = new double[] {0.1, 0.1, 0.1};
      tbDirectedGraph.setPreferredSize(new java.awt.Dimension(304, 242));
      containerTabbedPane.add(tbDirectedGraph);
      containerTabbedPane.setTitleAt(0, "Directed Graph");

      btnFilterDirectedGraph.setText("Filter Graph");
      tbDirectedGraph.add(
          btnFilterDirectedGraph,
          new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, 17, 0, new Insets(0, 5, 0, 5), 0, 0));
      btnFilterDirectedGraph.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              btnFilterDirectedGraphActionPerformed(evt);
            }
          });

      GridBagLayout dirVertexDegreePanelLayout = new GridBagLayout();
      dirVertexDegreePanel.setLayout(dirVertexDegreePanelLayout);
      dirVertexDegreePanelLayout.columnWidths = new int[] {1, 1};
      dirVertexDegreePanelLayout.rowHeights = new int[] {1, 1, 1, 1, 1};
      dirVertexDegreePanelLayout.columnWeights = new double[] {0.1, 0.1};
      dirVertexDegreePanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1};
      dirVertexDegreePanel.setBorder(
          new TitledBorder(
              new LineBorder(new java.awt.Color(0, 0, 0), 1, false),
              "Vertex Degree",
              TitledBorder.LEADING,
              TitledBorder.TOP,
              new java.awt.Font("Dialog", 1, 12),
              new java.awt.Color(0, 0, 0)));
      tbDirectedGraph.add(
          dirVertexDegreePanel,
          new GridBagConstraints(0, 0, 1, 3, 0.0, 0.0, 10, 1, new Insets(0, 0, 0, 0), 0, 0));

      lblMinInDegree.setText("In-Degree Minimum");
      dirVertexDegreePanel.add(
          lblMinInDegree,
          new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, 17, 0, new Insets(0, 5, 0, 5), 0, 0));

      lblMaxInDegree.setText("In-Degree Maximum");
      dirVertexDegreePanel.add(
          lblMaxInDegree,
          new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, 17, 0, new Insets(0, 5, 0, 5), 0, 0));

      lblMinOutDegree.setText("Out-Degree Minimum");
      dirVertexDegreePanel.add(
          lblMinOutDegree,
          new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, 17, 0, new Insets(0, 5, 0, 5), 0, 0));

      lblMaxOutDegree.setText("Out-Degree Maximum");
      dirVertexDegreePanel.add(
          lblMaxOutDegree,
          new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, 17, 0, new Insets(0, 5, 0, 5), 0, 0));

      tfInDegreeMin.setMinimumSize(new java.awt.Dimension(40, 20));
      dirVertexDegreePanel.add(
          tfInDegreeMin,
          new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));

      tfInDegreeMax.setMinimumSize(new java.awt.Dimension(40, 20));
      dirVertexDegreePanel.add(
          tfInDegreeMax,
          new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));

      tfOutDegreeMin.setMinimumSize(new java.awt.Dimension(40, 20));
      dirVertexDegreePanel.add(
          tfOutDegreeMin,
          new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));

      tfOutDegreeMax.setMinimumSize(new java.awt.Dimension(40, 20));
      dirVertexDegreePanel.add(
          tfOutDegreeMax,
          new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));

      lblIinstructions.setText(
          "<html>Enter degree values by which to filter graph. Leave blank to use minimum or maximum value.</html>");
      lblIinstructions.setHorizontalAlignment(SwingConstants.LEADING);
      lblIinstructions.setHorizontalTextPosition(SwingConstants.TRAILING);
      lblIinstructions.setVerticalAlignment(SwingConstants.TOP);
      lblIinstructions.setVerticalTextPosition(SwingConstants.CENTER);
      lblIinstructions.setPreferredSize(new java.awt.Dimension(60, 40));
      lblIinstructions.setMinimumSize(new java.awt.Dimension(60, 40));
      dirVertexDegreePanel.add(
          lblIinstructions,
          new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, 10, 1, new Insets(0, 0, 0, 0), 0, 0));

      GridBagLayout tbUndirectedGraphLayout = new GridBagLayout();
      tbUndirectedGraph.setLayout(tbUndirectedGraphLayout);
      tbUndirectedGraphLayout.columnWidths = new int[] {1};
      tbUndirectedGraphLayout.rowHeights = new int[] {1, 1, 1};
      tbUndirectedGraphLayout.columnWeights = new double[] {0.1};
      tbUndirectedGraphLayout.rowWeights = new double[] {0.1, 0.1, 0.1};
      tbUndirectedGraph.setPreferredSize(new java.awt.Dimension(304, 212));
      containerTabbedPane.add(tbUndirectedGraph);
      containerTabbedPane.setTitleAt(1, "Undirected Graph");

      GridBagLayout unDirVertexDegreePanelLayout = new GridBagLayout();
      unDirVertexDegreePanel.setLayout(unDirVertexDegreePanelLayout);
      unDirVertexDegreePanelLayout.columnWidths = new int[] {1, 1};
      unDirVertexDegreePanelLayout.rowHeights = new int[] {1, 1, 1, 1};
      unDirVertexDegreePanelLayout.columnWeights = new double[] {0.1, 0.1};
      unDirVertexDegreePanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1};
      unDirVertexDegreePanel.setBorder(
          new TitledBorder(
              new LineBorder(new java.awt.Color(0, 0, 0), 1, false),
              "Vertex Degree",
              TitledBorder.LEADING,
              TitledBorder.TOP,
              new java.awt.Font("Dialog", 1, 12),
              new java.awt.Color(0, 0, 0)));
      tbUndirectedGraph.add(
          unDirVertexDegreePanel,
          new GridBagConstraints(0, 0, 1, 2, 0.0, 0.0, 10, 1, new Insets(0, 0, 0, 0), 0, 0));

      lblMinDegree.setText("Minimum Degree");
      unDirVertexDegreePanel.add(
          lblMinDegree,
          new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, 17, 0, new Insets(0, 5, 0, 5), 0, 0));

      lblMaxDegree.setText("Maximum Degree");
      unDirVertexDegreePanel.add(
          lblMaxDegree,
          new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, 17, 0, new Insets(0, 5, 0, 5), 0, 0));

      tfMinDegree.setMinimumSize(new java.awt.Dimension(40, 20));
      unDirVertexDegreePanel.add(
          tfMinDegree,
          new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, 10, 0, new Insets(0, 0, 0, 0), 0, 0));

      tfMaxDegree.setMinimumSize(new java.awt.Dimension(40, 20));
      unDirVertexDegreePanel.add(
          tfMaxDegree,
          new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, 10, 0, new Insets(0, 0, 0, 0), 0, 0));

      lblInstructionsDir.setText(
          "<html>Enter degree values by which to filter graph. Leave blank to use minimum or maximum value.</html>");
      unDirVertexDegreePanel.add(
          lblInstructionsDir,
          new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, 10, 1, new Insets(0, 0, 0, 0), 0, 0));

      btnFilterUndirectedGraph.setText("Filter Graph");
      tbUndirectedGraph.add(
          btnFilterUndirectedGraph,
          new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, 17, 0, new Insets(5, 5, 5, 5), 0, 0));
      btnFilterUndirectedGraph.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              btnFilterUndirectedGraphActionPerformed(evt);
            }
          });

      postInitGUI();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Esempio n. 30
0
  public AddCompany() {
    setTitle("Add Company");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 392, 300);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    Calendar calendar = Calendar.getInstance();
    java.util.Date now = calendar.getTime();
    model = new UtilDateModel(now);
    Properties p = new Properties();
    p.put("text.today", "Today");
    p.put("text.month", "Month");
    p.put("text.year", "Year");
    datePanel = new JDatePanelImpl(model, p);

    label = new JLabel("");
    label.setVerticalTextPosition(SwingConstants.TOP);
    label.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
    JPanel panel = new JPanel();
    panel.setBorder(null);
    panel.setLayout(new GridLayout(0, 1, 0, 0));

    JSeparator separator = new JSeparator();

    JPanel panel_1 = new JPanel();
    panel_1.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));

    JLabel lblCompanyName = new JLabel("Company Name :");

    textField_2 = new JTextField();
    defaultBorder = textField_2.getBorder();
    textField_2.setColumns(10);

    textField_3 = new JTextField();
    textField_3.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyReleased(KeyEvent arg0) {
            checkDuplicate();
          }
        });
    textField_3.setColumns(10);

    JLabel lblCompanyCode_1 = new JLabel("Company Code :");

    JLabel lblDateCreated_1 = new JLabel("Date Created :");
    datePicker = new JDatePickerImpl(datePanel, new DateLabelFormatter());
    GroupLayout gl_contentPane = new GroupLayout(contentPane);
    gl_contentPane.setHorizontalGroup(
        gl_contentPane
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_contentPane
                    .createSequentialGroup()
                    .addGap(10)
                    .addComponent(panel_1, GroupLayout.DEFAULT_SIZE, 346, Short.MAX_VALUE)
                    .addGap(10))
            .addGroup(
                gl_contentPane
                    .createSequentialGroup()
                    .addGap(10)
                    .addComponent(separator, GroupLayout.DEFAULT_SIZE, 346, Short.MAX_VALUE)
                    .addGap(10))
            .addComponent(label, GroupLayout.DEFAULT_SIZE, 366, Short.MAX_VALUE)
            .addGroup(
                gl_contentPane
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(panel, GroupLayout.DEFAULT_SIZE, 346, Short.MAX_VALUE)
                    .addContainerGap()));
    gl_contentPane.setVerticalGroup(
        gl_contentPane
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_contentPane
                    .createSequentialGroup()
                    .addComponent(panel_1, GroupLayout.DEFAULT_SIZE, 170, Short.MAX_VALUE)
                    .addGap(11)
                    .addComponent(separator)
                    .addGap(11)
                    .addComponent(panel, GroupLayout.PREFERRED_SIZE, 29, GroupLayout.PREFERRED_SIZE)
                    .addGap(11)
                    .addComponent(
                        label, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)));
    GroupLayout gl_panel_1 = new GroupLayout(panel_1);
    gl_panel_1.setHorizontalGroup(
        gl_panel_1
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_panel_1
                    .createSequentialGroup()
                    .addGap(8)
                    .addGroup(
                        gl_panel_1
                            .createParallelGroup(Alignment.LEADING)
                            .addGroup(
                                gl_panel_1
                                    .createSequentialGroup()
                                    .addComponent(
                                        lblCompanyName,
                                        GroupLayout.PREFERRED_SIZE,
                                        98,
                                        GroupLayout.PREFERRED_SIZE)
                                    .addGap(34)
                                    .addComponent(
                                        textField_2,
                                        GroupLayout.DEFAULT_SIZE,
                                        194,
                                        Short.MAX_VALUE))
                            .addGroup(
                                gl_panel_1
                                    .createSequentialGroup()
                                    .addComponent(
                                        lblCompanyCode_1,
                                        GroupLayout.PREFERRED_SIZE,
                                        122,
                                        GroupLayout.PREFERRED_SIZE)
                                    .addGap(10)
                                    .addComponent(
                                        textField_3,
                                        GroupLayout.DEFAULT_SIZE,
                                        194,
                                        Short.MAX_VALUE))
                            .addComponent(
                                lblDateCreated_1,
                                GroupLayout.PREFERRED_SIZE,
                                134,
                                GroupLayout.PREFERRED_SIZE)
                            .addGroup(
                                gl_panel_1
                                    .createSequentialGroup()
                                    .addGap(132)
                                    .addComponent(
                                        datePicker,
                                        GroupLayout.DEFAULT_SIZE,
                                        194,
                                        Short.MAX_VALUE)))
                    .addGap(8)));
    gl_panel_1.setVerticalGroup(
        gl_panel_1
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_panel_1
                    .createSequentialGroup()
                    .addGap(6)
                    .addGroup(
                        gl_panel_1
                            .createParallelGroup(Alignment.LEADING)
                            .addGroup(
                                gl_panel_1
                                    .createSequentialGroup()
                                    .addGap(3)
                                    .addComponent(lblCompanyName))
                            .addComponent(
                                textField_2,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE))
                    .addGap(5)
                    .addGroup(
                        gl_panel_1
                            .createParallelGroup(Alignment.LEADING)
                            .addComponent(
                                lblCompanyCode_1,
                                GroupLayout.PREFERRED_SIZE,
                                33,
                                GroupLayout.PREFERRED_SIZE)
                            .addGroup(
                                gl_panel_1
                                    .createSequentialGroup()
                                    .addGap(6)
                                    .addComponent(
                                        textField_3,
                                        GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE,
                                        GroupLayout.PREFERRED_SIZE)))
                    .addGap(1)
                    .addGroup(
                        gl_panel_1
                            .createParallelGroup(Alignment.LEADING)
                            .addComponent(
                                lblDateCreated_1,
                                GroupLayout.PREFERRED_SIZE,
                                39,
                                GroupLayout.PREFERRED_SIZE)
                            .addGroup(
                                gl_panel_1
                                    .createSequentialGroup()
                                    .addGap(3)
                                    .addComponent(
                                        datePicker,
                                        GroupLayout.PREFERRED_SIZE,
                                        30,
                                        GroupLayout.PREFERRED_SIZE)))));
    panel_1.setLayout(gl_panel_1);

    JPanel panel_3 = new JPanel();
    panel.add(panel_3);
    panel_3.setLayout(new GridLayout(0, 2, 0, 0));

    btnNewButton = new JButton("Save");
    panel_3.add(btnNewButton);

    JButton btnNewButton_1 = new JButton("Cancel");
    panel_3.add(btnNewButton_1);
    btnNewButton_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            AddCompany.this.setVisible(false);
            backPage.setVisibility(true);
          }
        });
    btnNewButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Company comp = new Company();
            comp.setCompanyCode(textField_3.getText());
            comp.setCompanyName(textField_2.getText());
            // comp.setDateCreated("");
            Date selectedDate = (Date) datePicker.getModel().getValue();
            DateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");
            String reportDate = df.format(selectedDate);
            comp.setDateCreated(Utilities.getTime(reportDate));

            try {
              new Company().setObject(comp);
            } catch (Exception e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
              // Error occurs
              label.setText("Failed to add company!");
            }
            // If successful, reset the fields
            label.setText("Company successfully added!");
            reset();
          }
        });
    contentPane.setLayout(gl_contentPane);
  }