Beispiel #1
0
  /**
   * Set the value of content
   *
   * @param newVar the new value of content
   */
  private void setContent(final counts a, final connections cnc_a) {
    // Creates a new container
    content = frame.getContentPane();
    // sets the layout
    content.setLayout(new BorderLayout());

    this.setTaskbar(); // sets the taskbar
    // adding the taskbar to the bottom-part
    content.add(taskbar, BorderLayout.SOUTH);

    this.setDraw_pad(a, cnc_a, this.getTaskbar()); // sets the drawPad
    JScrollPane Padscroller = new JScrollPane();
    Padscroller.setWheelScrollingEnabled(true);
    Padscroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    Padscroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    Padscroller.setPreferredSize(new Dimension(200, 100));
    // Padscroller.setMinimumSize(new Dimension(200, 100));
    // Padscroller.setMaximumSize(new Dimension(200, 100));
    Padscroller.setViewportView(drawPad);
    content.add(Padscroller, BorderLayout.CENTER);

    this.setPanel(a, cnc_a); // sets the panel
    JScrollPane scroller = new JScrollPane(panel);
    scroller.setWheelScrollingEnabled(true);
    scroller.setPreferredSize(new Dimension(125, 80));
    scroller.setMinimumSize(new Dimension(125, 80));
    scroller.setMaximumSize(new Dimension(125, 80));
    // sets the scroller to the west portion
    content.add(scroller, BorderLayout.WEST);
    // content.add(panel, BorderLayout.WEST);
  }
  private void initComponents() {

    final SimpleDateFormat dateFrmt = new SimpleDateFormat(DEFAULT_DATE_FORMAT);
    panel = new JPanel();
    panel.setLayout(new BorderLayout());
    JPanel north = new JPanel();
    north.setLayout(new BoxLayout(north, BoxLayout.X_AXIS));
    JLabel dateLbl = new JLabel("検査日:");
    north.add(dateLbl);
    dateFld = new JTextField(10);
    dateFld.setMaximumSize(dateFld.getPreferredSize());
    dateFld.setEditable(false);
    dateFld.setText(dateFrmt.format(new Date()));
    north.add(dateFld);
    north.add(Box.createHorizontalGlue());
    editCheck = new JCheckBox("項目編集");
    north.add(editCheck);
    panel.add(north, BorderLayout.NORTH);

    JPanel south = new JPanel();
    south.setLayout(new FlowLayout());
    deleteBtn = new JButton("削除", deleteIcon);
    deleteBtn.setEnabled(false);
    south.add(deleteBtn);
    closeBtn = new JButton("閉じる", closeIcon);
    south.add(closeBtn);
    saveBtn = new JButton("保存", saveIcon);
    south.add(saveBtn);
    panel.add(south, BorderLayout.SOUTH);

    setTable = new JTable();
    JScrollPane scroll = new JScrollPane(setTable);
    centerPanel = new JPanel();
    centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.X_AXIS));
    centerPanel.add(scroll);
    panel.add(centerPanel, BorderLayout.CENTER);

    templateTable = new JTable();
    templateTable.setToolTipText("DnDで左の施設内検査項目テーブルに追加してください。");
    rtScroll = new JScrollPane(templateTable);
    Dimension d = new Dimension(200, 200);
    rtScroll.setPreferredSize(d);
    d = new Dimension(200, Integer.MAX_VALUE);
    rtScroll.setMaximumSize(d);

    dialog = new JDialog();
    String title = ClientContext.getFrameTitle("院内検査項目追加");
    dialog.setTitle(title);
    dialog.setModal(true);
    dialog.setContentPane(panel);
    ClientContext.setDolphinIcon(dialog);

    dialog.pack();
    dialog.setLocationRelativeTo(chart.getFrame());
  }
  /** Constructor. */
  public TilePatternsView() {
    super();

    tilePatternIcons = new ArrayList<TilePatternIcon>();

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    // tileset properties
    // the tile pattern list
    // view of the current tile pattern

    // tileset properties
    tilesetPropertiesView = new TilesetPropertiesView();
    tilesetPropertiesView.setMaximumSize(new Dimension(Integer.MAX_VALUE, 120));
    tilesetPropertiesView.setAlignmentX(Component.LEFT_ALIGNMENT);

    // list
    tilePatternsListModel = new TilePatternsListModel();
    tilePatternsList = new JList(tilePatternsListModel);
    tilePatternsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    tilePatternsList.setLayoutOrientation(JList.HORIZONTAL_WRAP);
    tilePatternsList.setVisibleRowCount(-1); // make the rows as wide as possible
    tilePatternsList
        .getSelectionModel()
        .addListSelectionListener(new TilePatternListSelectionListener());
    tilePatternsList.setCellRenderer(new TilePatternListRenderer());

    tilePatternsList.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent keyEvent) {
            if (keyEvent.getKeyCode() == KeyEvent.VK_DELETE) {
              if (tileset != null && tileset.getSelectedTilePattern() != null) {
                tileset.removeTilePattern();
              }
            }
          }
        });

    JScrollPane listScroller = new JScrollPane(tilePatternsList);
    listScroller.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
    listScroller.setAlignmentX(Component.LEFT_ALIGNMENT);

    // tile view
    tilePatternView = new TilePatternView();
    tilePatternView.setMaximumSize(new Dimension(Integer.MAX_VALUE, 300));
    tilePatternView.setAlignmentX(Component.LEFT_ALIGNMENT);

    add(tilesetPropertiesView);
    add(Box.createRigidArea(new Dimension(0, 5)));
    add(listScroller);
    add(Box.createRigidArea(new Dimension(0, 5)));
    add(tilePatternView);
  }
  protected JScrollPane createDirectoryList() {
    directoryList = new JList();
    align(directoryList);

    directoryList.setCellRenderer(new DirectoryCellRenderer());
    directoryList.setModel(new MotifDirectoryListModel());
    directoryList.addMouseListener(createDoubleClickListener(getFileChooser(), directoryList));
    directoryList.addListSelectionListener(createListSelectionListener(getFileChooser()));

    JScrollPane scrollpane = new JScrollPane(directoryList);
    scrollpane.setMaximumSize(MAX_SIZE);
    scrollpane.setPreferredSize(prefListSize);
    align(scrollpane);
    return scrollpane;
  }
  protected JScrollPane createFilesList() {
    fileList = new JList();

    if (getFileChooser().isMultiSelectionEnabled()) {
      fileList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    } else {
      fileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    }

    fileList.setModel(new MotifFileListModel());
    fileList.setCellRenderer(new FileCellRenderer());
    fileList.addListSelectionListener(createListSelectionListener(getFileChooser()));
    fileList.addMouseListener(createDoubleClickListener(getFileChooser(), fileList));
    align(fileList);
    JScrollPane scrollpane = new JScrollPane(fileList);
    scrollpane.setPreferredSize(prefListSize);
    scrollpane.setMaximumSize(MAX_SIZE);
    align(scrollpane);
    return scrollpane;
  }
  public void initPanel() {
    // The panel uses an absolute layout.
    setLayout(null);

    // Name
    nameField = new JFormattedTextField(20);
    nameField.setEditable(false);
    addRow("Name", nameField);

    // Label
    labelField = new JTextField(20);
    labelField.addActionListener(this);
    labelField.addFocusListener(this);
    addRow("Label", labelField);

    // Help Text
    helpTextField = new JTextField(20);
    helpTextField.addActionListener(this);
    helpTextField.addFocusListener(this);
    addRow("Help Text", helpTextField);

    // Widget
    widgetBox = new JComboBox(humanizedWidgets);
    widgetBox.addActionListener(this);
    addRow("Type", widgetBox);

    // Value
    valueField = new JTextField(20);
    valueField.addActionListener(this);
    valueField.addFocusListener(this);
    addRow("Value", valueField);

    // Enable If
    enableIfField = new JTextField(20);
    enableIfField.addActionListener(this);
    enableIfField.addFocusListener(this);
    addRow("Enable If", enableIfField);

    // Bounding Method
    boundingMethodBox = new JComboBox(new String[] {"none", "soft", "hard"});
    boundingMethodBox.addActionListener(this);
    addRow("Bounding", boundingMethodBox);

    // Minimum Value
    minimumValueCheck = new JCheckBox();
    minimumValueCheck.addActionListener(this);
    minimumValueField = new JTextField(10);
    minimumValueField.addActionListener(this);
    minimumValueField.addFocusListener(this);
    JPanel minimumValuePanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 0));
    minimumValuePanel.add(minimumValueCheck);
    minimumValuePanel.add(minimumValueField);
    addRow("Minimum", minimumValuePanel);

    // Maximum Value
    maximumValueCheck = new JCheckBox();
    maximumValueCheck.addActionListener(this);
    maximumValueField = new JTextField(10);
    maximumValueField.addActionListener(this);
    maximumValueField.addFocusListener(this);
    JPanel maximumValuePanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 0));
    maximumValuePanel.add(maximumValueCheck);
    maximumValuePanel.add(maximumValueField);
    addRow("Maximum", maximumValuePanel);

    // Display Level
    displayLevelBox = new JComboBox(new String[] {"hud", "detail", "hidden"});
    displayLevelBox.addActionListener(this);
    addRow("Display Level", displayLevelBox);

    // Menu Items
    menuItemsTable = new JTable(new MenuItemsModel());
    menuItemsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    JPanel tablePanel = new JPanel(new BorderLayout(5, 5));
    JScrollPane tableScroll =
        new JScrollPane(
            menuItemsTable,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    tableScroll.setSize(200, 170);
    tableScroll.setPreferredSize(new Dimension(200, 170));
    tableScroll.setMaximumSize(new Dimension(200, 170));
    tableScroll.setMinimumSize(new Dimension(200, 170));
    tablePanel.add(tableScroll, BorderLayout.CENTER);
    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 5));
    addButton = new JButton(new Icons.PlusIcon());
    addButton.addActionListener(this);
    removeButton = new JButton(new Icons.MinusIcon());
    removeButton.addActionListener(this);
    upButton = new JButton(new Icons.ArrowIcon(Icons.ArrowIcon.NORTH));
    upButton.addActionListener(this);
    downButton = new JButton(new Icons.ArrowIcon(Icons.ArrowIcon.SOUTH));
    downButton.addActionListener(this);
    buttonPanel.add(addButton);
    buttonPanel.add(removeButton);
    buttonPanel.add(upButton);
    buttonPanel.add(downButton);
    tablePanel.add(buttonPanel, BorderLayout.SOUTH);
    addRow("Menu Items", tablePanel);
  }
  private void initialize() {
    setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    JLabel label =
        new JLabel(
            "It is up to you whether or not to include the source when you distribute your robot.");

    label.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(label);

    label =
        new JLabel(
            "If you include the source, other people will be able to look at your code and learn from it.");
    label.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(label);

    getIncludeSource().setAlignmentX(Component.LEFT_ALIGNMENT);
    add(getIncludeSource());

    label = new JLabel(" ");
    label.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(label);

    add(getVersionLabel());

    JPanel p = new JPanel();

    p.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
    p.setAlignmentX(Component.LEFT_ALIGNMENT);
    getVersionField().setAlignmentX(Component.LEFT_ALIGNMENT);
    getVersionField().setMaximumSize(getVersionField().getPreferredSize());
    p.setMaximumSize(new Dimension(Integer.MAX_VALUE, getVersionField().getPreferredSize().height));
    p.add(getVersionField());
    p.add(getVersionHelpLabel());
    add(p);

    label = new JLabel(" ");
    label.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(label);

    add(getDescriptionLabel());

    JScrollPane scrollPane =
        new JScrollPane(
            getDescriptionArea(),
            ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);

    scrollPane.setMaximumSize(scrollPane.getPreferredSize());
    scrollPane.setMinimumSize(new Dimension(100, scrollPane.getPreferredSize().height));
    scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(scrollPane);

    label = new JLabel(" ");
    label.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(label);

    add(getAuthorLabel());

    getAuthorField().setAlignmentX(Component.LEFT_ALIGNMENT);
    getAuthorField().setMaximumSize(getAuthorField().getPreferredSize());
    add(getAuthorField());

    label = new JLabel(" ");
    label.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(label);

    add(getWebpageLabel());

    getWebpageField().setAlignmentX(Component.LEFT_ALIGNMENT);
    getWebpageField().setMaximumSize(getWebpageField().getPreferredSize());
    add(getWebpageField());

    getWebpageHelpLabel().setAlignmentX(Component.LEFT_ALIGNMENT);
    add(getWebpageHelpLabel());

    JPanel panel = new JPanel();

    panel.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(panel);
    addComponentListener(eventHandler);
  }