示例#1
0
  public void setOptions(BeautiOptions options) {
    this.options = options;

    chainLengthField.setValue(options.chainLength);
    echoEveryField.setValue(options.echoEvery);
    logEveryField.setValue(options.logEvery);

    if (options.fileNameStem != null) {
      fileNameStemField.setText(options.fileNameStem);
    } else {
      fileNameStemField.setText(DEFAULT_FILE_NAME_STEM);
      fileNameStemField.setEnabled(false);
    }

    operatorAnalaysisCheck.setSelected(options.operatorAnalysis);

    updateOtherFileNames(options);

    if (options.contains(Microsatellite.INSTANCE)) {
      samplePriorCheckBox.setSelected(false);
      samplePriorCheckBox.setVisible(false);
    } else {
      samplePriorCheckBox.setVisible(true);
      samplePriorCheckBox.setSelected(options.samplePriorOnly);
    }

    optionsPanel.validate();
    optionsPanel.repaint();
  }
  /**
   * This function takes the given customer or waiter object and changes the information panel to
   * hold that person's info.
   *
   * @param person customer or waiter object
   */
  public void updateInfoPanel(Object person) {
    stateCB.setVisible(true);
    changeOrder.setVisible(false);
    currentPerson = person;

    if (person instanceof CustomerAgent) {
      CustomerAgent customer = (CustomerAgent) person;
      stateCB.setText("Hungry?");
      changeOrder.setVisible(true);
      // changeOrder.setText("Change Order?");
      // changeOrder.setSelected(customer.waiter.requestingChange(customer));
      // changeOrder.setEnabled(!customer.waiter.requestingChange(customer));
      stateCB.setSelected(customer.isHungry());
      stateCB.setEnabled(!customer.isHungry());
      infoLabel.setText("<html><pre>     Name: " + customer.getName() + " </pre></html>");

    } else if (person instanceof WaiterAgent) {
      WaiterAgent waiter = (WaiterAgent) person;
      // stateCB.setText("On Break?");
      // stateCB.setSelected(waiter.isOnBreak());
      // stateCB.setEnabled(true);
      requestBreak.setVisible(true);
      stateCB.setVisible(false);
      changeOrder.setVisible(false);
      infoLabel.setText("<html><pre>     Name: " + waiter.getName() + " </html>");
    }

    infoPanel.validate();
  }
 @Override
 public Component getTreeCellRendererComponent(
     JTree tree,
     Object value,
     boolean selected,
     boolean expanded,
     boolean leaf,
     int row,
     boolean hasFocus) {
   invalidate();
   final VirtualFile file = getFile(value);
   final DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
   if (file == null) {
     if (value instanceof DefaultMutableTreeNode) {
       final Object uo = node.getUserObject();
       if (uo instanceof String) {
         myColoredRenderer.getTreeCellRendererComponent(
             tree, value, selected, expanded, leaf, row, hasFocus);
         return myColoredRenderer;
       }
     }
     return myEmpty;
   }
   myCheckbox.setVisible(true);
   final TreeNodeState state = mySelectionManager.getState(node);
   myCheckbox.setEnabled(
       TreeNodeState.CLEAR.equals(state) || TreeNodeState.SELECTED.equals(state));
   myCheckbox.setSelected(!TreeNodeState.CLEAR.equals(state));
   myCheckbox.setOpaque(false);
   myCheckbox.setBackground(null);
   setBackground(null);
   myTextRenderer.getListCellRendererComponent(myFictive, file, 0, selected, hasFocus);
   revalidate();
   return this;
 }
  public SimpleOpenTaskDialog(@NotNull final Project project, @NotNull final Task task) {
    super(project, false);
    myProject = project;
    myTask = task;
    TaskManagerImpl taskManager = (TaskManagerImpl) TaskManager.getManager(myProject);
    setTitle("Open Task");
    myTaskNameLabel.setText(TaskUtil.getTrimmedSummary(task));

    TaskManagerImpl manager = (TaskManagerImpl) TaskManager.getManager(project);
    ControlBinder binder = new ControlBinder(manager.getState());
    binder.bindAnnotations(this);
    binder.reset();

    TaskRepository repository = task.getRepository();
    if (repository == null
        || !repository
            .getRepositoryType()
            .getPossibleTaskStates()
            .contains(TaskState.IN_PROGRESS)) {
      myMarkAsInProgressBox.setVisible(false);
    }

    myClearContext.setSelected(taskManager.getState().clearContext);

    if (!manager.isVcsEnabled()) {
      myCreateChangelist.setEnabled(false);
      myCreateChangelist.setSelected(false);
    } else {
      myCreateChangelist.setSelected(taskManager.getState().createChangelist);
      myCreateChangelist.setEnabled(true);
    }
    init();
    getPreferredFocusedComponent();
  }
  public void setVisible(boolean isVisible) {
    if (isVisible) {
      if (firstAppearance) {
        this.setLocationRelativeTo(parent);
        firstAppearance = false;
      }

      if (mode == DialogMode.TASK) useXQuery.setVisible(true);
      else {
        useXQuery.setVisible(false);
        useXQuery.setSelected(true);
        xQueryEditor.setValidating(true);
      }
    }
    super.setVisible(isVisible);
  }
  protected JComponent createNorthPanel() {
    if (!mySearchTextOccurencesEnabled) {
      myCbSearchTextOccurences.setEnabled(false);
      myCbSearchTextOccurences.setVisible(false);
      myCbSearchTextOccurences.setSelected(false);
    }

    return myMainPanel;
  }
示例#7
0
 /**
  * updateCustomerInformationPanel() takes the given customer (or, for v3, Host) object and changes
  * the information panel to hold that person's info.
  *
  * @param temp customer (or waiter) object
  */
 public void updateCustomerInformationPanel(Customer temp) {
   customerStateCheckBox.setVisible(true);
   currentCustomer = temp;
   Customer customer = temp;
   customerStateCheckBox.setText("Hungry?");
   customerStateCheckBox.setSelected(customer.getGui().isHungry());
   customerStateCheckBox.setEnabled(!customer.getGui().isHungry());
   infoCustomerLabel.setText("<html><pre>     Name: " + customer.getName() + " </pre></html>");
   customerInformationPanel.validate();
 }
示例#8
0
 @Override
 public void valueChanged(ListSelectionEvent lsEve) {
   int rowNum = table.getSelectedRow();
   int colNum = table.getSelectedColumn();
   //            System.out.println("Reached in else");
   if (colNum > 0) {
     selectAllCB.setVisible(false);
     deleteBut.setVisible(false);
     new MessagePan(rowNum, workingSet);
     backBut.setVisible(true);
     Home.home.homeFrame.setVisible(true);
   }
 }
    private MyCheckboxTreeCellRenderer(
        final SelectionManager selectionManager,
        Map<VirtualFile, String> modulesSet,
        final Project project,
        final JTree tree,
        final Collection<VirtualFile> roots) {
      super(new BorderLayout());
      mySelectionManager = selectionManager;
      myModulesSet = modulesSet;
      myRoots = roots;
      setBackground(tree.getBackground());
      myColoredRenderer =
          new ColoredTreeCellRenderer() {
            @Override
            public void customizeCellRenderer(
                JTree tree,
                Object value,
                boolean selected,
                boolean expanded,
                boolean leaf,
                int row,
                boolean hasFocus) {
              append(value.toString());
            }
          };
      myFictive = new JBList();
      myFictive.setBackground(tree.getBackground());
      myFictive.setSelectionBackground(UIUtil.getListSelectionBackground());
      myFictive.setSelectionForeground(UIUtil.getListSelectionForeground());

      myTextRenderer =
          new WithModulesListCellRenderer(project, myModulesSet) {
            @Override
            protected void putParentPath(Object value, FilePath path, FilePath self) {
              if (myRoots.contains(self.getVirtualFile())) {
                super.putParentPath(value, path, self);
              }
            }
          };
      myTextRenderer.setBackground(tree.getBackground());

      myCheckbox = new JCheckBox();
      myCheckbox.setBackground(tree.getBackground());
      myEmpty = new JLabel("");

      add(myCheckbox, BorderLayout.WEST);
      add(myTextRenderer, BorderLayout.CENTER);
      myCheckbox.setVisible(true);
    }
  public EditorOptionsPanel() {
    if (SystemInfo.isMac) {
      myCbEnableWheelFontChange.setText(
          ApplicationBundle.message("checkbox.enable.ctrl.mousewheel.changes.font.size.macos"));
    }

    myStripTrailingSpacesCombo.addItem(STRIP_CHANGED);
    myStripTrailingSpacesCombo.addItem(STRIP_ALL);
    myStripTrailingSpacesCombo.addItem(STRIP_NONE);
    ActionListener explainer =
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            explainTrailingSpaces(getStripTrailingSpacesValue());
          }
        };
    myStripTrailingSpacesCombo.addActionListener(explainer);
    myCbVirtualSpace.addActionListener(explainer);

    myHighlightSettingsPanel.setLayout(new BorderLayout());
    myHighlightSettingsPanel.add(myErrorHighlightingPanel.getPanel(), BorderLayout.CENTER);

    myCbRenameLocalVariablesInplace.setVisible(
        OptionsApplicabilityFilter.isApplicable(OptionId.RENAME_IN_PLACE));

    myRichCopyColorSchemeComboBox.setRenderer(
        new ListCellRendererWrapper<String>() {
          @Override
          public void customize(
              JList list, String value, int index, boolean selected, boolean hasFocus) {
            final String textToUse;
            if (RichCopySettings.ACTIVE_GLOBAL_SCHEME_MARKER.equals(value)) {
              textToUse = ACTIVE_COLOR_SCHEME;
            } else {
              textToUse = value;
            }
            setText(textToUse);
          }
        });

    myConfigurable = new MyConfigurable();
    initQuickDocProcessing();
    initSoftWrapsSettingsProcessing();
    initVcsSettingsProcessing();
  }
  @Override
  public void update(final AnActionEvent e) {
    super.update(e);
    Presentation presentation = e.getPresentation();
    Object property = presentation.getClientProperty(CUSTOM_COMPONENT_PROPERTY);
    if (property instanceof JCheckBox) {
      JCheckBox checkBox = (JCheckBox) property;

      checkBox.setText(presentation.getText());
      checkBox.setToolTipText(presentation.getDescription());
      checkBox.setMnemonic(presentation.getMnemonic());
      checkBox.setDisplayedMnemonicIndex(presentation.getDisplayedMnemonicIndex());
      checkBox.setSelected(Boolean.TRUE.equals(presentation.getClientProperty(SELECTED_PROPERTY)));

      checkBox.setEnabled(presentation.isEnabled());
      checkBox.setVisible(presentation.isVisible());
    }
  }
  @Override
  protected JComponent createCenterPanel() {
    myTitle.setText(myText);
    myOptionsPanel.setBorder(
        IdeBorderFactory.createTitledBorder(
            CodeInsightBundle.message("reformat.directory.dialog.options")));
    myFiltersPanel.setBorder(
        IdeBorderFactory.createTitledBorder(
            CodeInsightBundle.message("reformat.directory.dialog.filters")));

    myMaskWarningLabel.setIcon(AllIcons.General.Warning);
    myMaskWarningLabel.setVisible(false);

    myIncludeSubdirsCb.setVisible(shouldShowIncludeSubdirsCb());

    initFileTypeFilter();
    initScopeFilter();

    restoreCbsStates();
    return myWholePanel;
  }
  public KotlinCompilerConfigurableTab(
      Project project,
      CommonCompilerArguments commonCompilerArguments,
      K2JSCompilerArguments k2jsCompilerArguments,
      CompilerSettings compilerSettings,
      @Nullable KotlinCompilerWorkspaceSettings compilerWorkspaceSettings) {
    this.project = project;
    this.commonCompilerArguments = commonCompilerArguments;
    this.k2jsCompilerArguments = k2jsCompilerArguments;
    this.compilerSettings = compilerSettings;
    this.compilerWorkspaceSettings = compilerWorkspaceSettings;

    additionalArgsOptionsField.attachLabel(additionalArgsLabel);

    setupFileChooser(
        labelForOutputPrefixFile,
        outputPrefixFile,
        KotlinBundle.message("kotlin.compiler.js.option.output.prefix.browse.title"));
    setupFileChooser(
        labelForOutputPostfixFile,
        outputPostfixFile,
        KotlinBundle.message("kotlin.compiler.js.option.output.postfix.browse.title"));

    labelForOutputDirectory.setLabelFor(outputDirectory);
    copyRuntimeFilesCheckBox.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(@NotNull ChangeEvent e) {
            outputDirectory.setEnabled(copyRuntimeFilesCheckBox.isSelected());
            labelForOutputDirectory.setEnabled(copyRuntimeFilesCheckBox.isSelected());
          }
        });

    fillModuleKindList();

    if (compilerWorkspaceSettings == null) {
      keepAliveCheckBox.setVisible(false);
      k2jvmPanel.setVisible(false);
    }
  }
 public CreateResourceBundleDialogComponent(
     Project project, PsiDirectory directory, ResourceBundle resourceBundle) {
   myProject = project;
   myDirectory = directory;
   myResourceBundle = resourceBundle;
   if (resourceBundle != null) {
     myResourceBundleNamePanel.setVisible(false);
     myUseXMLBasedPropertiesCheckBox.setVisible(false);
   } else {
     final String checkBoxSelectedStateKey = getClass() + ".useXmlPropertiesFiles";
     myUseXMLBasedPropertiesCheckBox.setSelected(
         PropertiesComponent.getInstance().getBoolean(checkBoxSelectedStateKey));
     myUseXMLBasedPropertiesCheckBox.addContainerListener(
         new ContainerAdapter() {
           @Override
           public void componentRemoved(ContainerEvent e) {
             PropertiesComponent.getInstance()
                 .setValue(checkBoxSelectedStateKey, myUseXMLBasedPropertiesCheckBox.isSelected());
           }
         });
   }
 }
示例#15
0
  private JPanel createRightPanel() {
    final JPanel right = new JPanel(new GridBagLayout());
    final GridBagConstraints rgc =
        new GridBagConstraints(
            0,
            GridBagConstraints.RELATIVE,
            1,
            1,
            1,
            0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0),
            0,
            0);
    myReplaceAllCb = new JCheckBox("Replace all occurrences");
    myReplaceAllCb.setMnemonic('a');
    myReplaceAllCb.setFocusable(false);
    myReplaceAllCb.setVisible(myOccurrences.length > 1);
    right.add(myReplaceAllCb, rgc);

    return right;
  }
 public void setCopyJavadocVisible(boolean state) {
   myCopyJavadocCheckbox.setVisible(state);
 }
  @Override
  protected void init() {
    super.init();

    JavaRefactoringSettings settings = JavaRefactoringSettings.getInstance();

    initReplaceFieldsWithGetters(settings);

    myDeclareFinalCheckBox.setSelected(hasFinalModifier());
    myDelegateViaOverloadingMethodCheckBox.setVisible(myInfo.getToSearchFor() != null);

    setTitle(RefactoringBundle.message("introduce.parameter.title"));

    myTable.init(myInfo);

    final GrParameter[] parameters = myInfo.getToReplaceIn().getParameters();
    toRemoveCBs.forEachEntry(
        new TObjectIntProcedure<JCheckBox>() {
          @Override
          public boolean execute(JCheckBox checkbox, int index) {
            checkbox.setSelected(true);

            final GrParameter param = parameters[index];
            final ParameterInfo pinfo = findParamByOldName(param.getName());
            if (pinfo != null) {
              pinfo.setPassAsParameter(false);
            }
            return true;
          }
        });

    updateSignature();

    if (myCanIntroduceSimpleParameter) {
      mySignaturePanel.setVisible(false);

      // action to hide signature panel if we have variants to introduce simple parameter
      myTypeComboBox.addItemListener(
          new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
              mySignaturePanel.setVisible(myTypeComboBox.isClosureSelected());
              pack();
            }
          });
    }

    final PsiType closureReturnType = inferClosureReturnType();
    if (PsiType.VOID.equals(closureReturnType)) {
      myForceReturnCheckBox.setEnabled(false);
      myForceReturnCheckBox.setSelected(false);
    } else {
      myForceReturnCheckBox.setSelected(isForceReturn());
    }

    if (myInfo.getToReplaceIn() instanceof GrClosableBlock) {
      myDelegateViaOverloadingMethodCheckBox.setEnabled(false);
      myDelegateViaOverloadingMethodCheckBox.setToolTipText(
          "Delegating is not allowed in closure context");
    }

    pack();
  }
  private void setupTypeInfo(Type.Continuous t) {
    UPBDetailPanel.setVisible(false);
    LWBDetailPanel.setVisible(false);

    yesUPB.setEnabled(false);
    noUPB.setEnabled(false);
    unspecifiedUPB.setEnabled(false);
    if (t.UPB < Double.MAX_VALUE) {
      yesUPB.setSelected(true);
      specifyUPB.setVisible(true);
      UPBDetailPanel.setVisible(true);
      if (t.UPB < Double.MAX_VALUE - Double.MIN_VALUE) {
        specifyUPB.setEnabled(false);
        specifyUPB.setSelected(true);
        UPBLabel.setVisible(true);
        UPBLabel.setEnabled(false);
        UPBLabel.setText("" + t.UPB);
      } else {
        specifyUPB.setEnabled(true);
        specifyUPB.setSelected(false);
        UPBLabel.setVisible(false);
        UPBLabel.setEnabled(true);
      }
    } else {
      unspecifiedUPB.setEnabled(true);
      specifyUPB.setVisible(false);
      UPBLabel.setVisible(false);
    }

    yesLWB.setEnabled(false);
    noLWB.setEnabled(false);
    unspecifiedLWB.setEnabled(false);
    if (t.LWB > -Double.MAX_VALUE) {
      yesLWB.setSelected(true);
      specifyLWB.setVisible(true);
      LWBDetailPanel.setVisible(true);
      if (t.LWB > -Double.MAX_VALUE + Double.MIN_VALUE) {
        specifyLWB.setEnabled(false);
        specifyLWB.setSelected(true);
        LWBLabel.setVisible(true);
        LWBLabel.setEnabled(false);
        LWBLabel.setText("" + t.LWB);
      } else {
        specifyLWB.setEnabled(true);
        specifyLWB.setSelected(false);
        LWBLabel.setVisible(false);
        LWBLabel.setEnabled(true);
      }
    } else {
      unspecifiedLWB.setEnabled(true);
      specifyLWB.setVisible(false);
      LWBLabel.setVisible(false);
    }

    if (t.ckIsCyclic) {
      yesCyclic.setEnabled(false);
      noCyclic.setEnabled(false);
      unspecifiedCyclic.setEnabled(false);
      if (t.isCyclic) {
        yesCyclic.setSelected(true);
      } else {
        noCyclic.setSelected(true);
      }
    } else {
      unspecifiedCyclic.setSelected(true);
      yesCyclic.setEnabled(true);
      noCyclic.setEnabled(true);
      unspecifiedCyclic.setEnabled(true);
    }

    excUPBButton.setEnabled(true);
    incUPBButton.setEnabled(true);
    incUPBButton.setSelected(true);

    excLWBButton.setEnabled(true);
    incLWBButton.setEnabled(true);
    incLWBButton.setSelected(true);
  }
 /**
  * Shows or hides the "save password" checkbox.
  *
  * @param allow the checkbox is shown when allow is <tt>true</tt>
  */
 public void setAllowSavePassword(boolean allow) {
   rememberPassCheckBox.setVisible(allow);
 }
示例#20
0
  public void setContent(String cat) {
    cat = cat.trim();
    selectAllCB.setVisible(false);
    selectAllCB.setSelected(false);
    deleteBut.setVisible(false);
    restoreBut.setVisible(false);
    refreshBut.setVisible(true);
    Object columns[] = null;
    int count = 0;
    switch (cat) {
      case "Inbox":
        columns = new Object[] {"", "From", "Date", "Subject", "Content"};
        count = Database.getCount("Inbox");
        workingSet = db.getData("SELECT * FROM messages WHERE tag='inbox' ORDER BY msg_id desc");
        ;
        break;
      case "SentMail":
        columns = new Object[] {"", "To", "Date", "Subject", "Content"};
        count = Database.getCount("Sentmail");
        workingSet = db.getData("SELECT * FROM messages WHERE tag='sentmail' ORDER BY msg_id desc");
        break;
      case "Draft":
        columns = new Object[] {"", "To", "Date", "Subject", "Content"};
        count = Database.getCount("Draft");
        workingSet = db.getData("SELECT * FROM messages WHERE tag='draft' ORDER BY msg_id desc");
        break;
      case "Outbox":
        columns = new Object[] {"", "To", "Date", "Subject", "Content"};
        count = Database.getCount("Outbox");
        workingSet = db.getData("SELECT * FROM messages WHERE tag='outbox' ORDER BY msg_id desc");
        break;
      case "Trash":
        //                restoreBut.setVisible(true);
        columns = new Object[] {"", "To/From", "Date", "Subject", "Content"};
        count = Database.getCount("Trash");
        workingSet =
            db.getData(
                "SELECT * FROM messages,trash WHERE messages.tag='trash' and messages.msg_id=trash.msg_id ORDER BY deleted_at desc");
        break;
      default:
        System.out.println("in default case");
    }
    if (count > 0) {
      selectAllCB.setVisible(true);
      rows = new Object[count][];
      msgID = new int[count];
      try {
        workingSet.beforeFirst();
        for (int i = 0; i < count && workingSet.next(); i++) {
          msgID[i] = workingSet.getInt(1);
          rows[i] =
              new Object[] {
                false,
                workingSet.getString(2),
                workingSet.getDate(3),
                workingSet.getString(4),
                workingSet.getString(5)
              };
        }
      } catch (SQLException sqlExc) {
        JOptionPane.showMessageDialog(null, sqlExc, "EXCEPTION", JOptionPane.ERROR_MESSAGE);
        sqlExc.printStackTrace();
      }

      tableModel = new MyDefaultTableModel(rows, columns);
      table = new JTable(tableModel);
      table.getSelectionModel().addListSelectionListener(this);
      table.addMouseListener(this);
      table.getTableHeader().setOpaque(true);
      table.getTableHeader().setReorderingAllowed(false);
      //            table.getTableHeader().setBackground(Color.blue);
      table.getTableHeader().setForeground(Color.blue);
      //        table.setRowSelectionAllowed(false);
      //            table.setColumnSelectionAllowed(false);
      table.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 14));
      table.setRowHeight(20);
      table.setFillsViewportHeight(true);

      TableColumn column = null;
      for (int i = 0; i < 5; i++) {
        column = table.getColumnModel().getColumn(i);
        if (i == 0) {
          column.setPreferredWidth(6);
        } else if (i == 3) {
          column.setPreferredWidth(250);
        } else if (i == 4) {
          column.setPreferredWidth(450);
        } else {
          column.setPreferredWidth(40);
        }
      }
      table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);

      remove(contentPan);
      contentPan = new JScrollPane(table);
      contentPan.setBackground(Color.orange);
      contentPan.setOpaque(true);
      contentPan.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
      add(contentPan, "Center");
      Home.home.homeFrame.setVisible(true);
    } else {
      JPanel centPan = new JPanel(new GridBagLayout());
      centPan.setBackground(new Color(52, 86, 70));
      JLabel label = new JLabel("No Messages In This Category");
      label.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 22));
      label.setForeground(Color.orange);
      centPan.add(label);
      remove(contentPan);
      contentPan = new JScrollPane(centPan);
      contentPan.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
      add(contentPan, "Center");
      contentPan.repaint();
    }
  }
示例#21
0
  public void createGUI() {
    setLayout(new BorderLayout());
    toolBar = new JToolBar("options", JToolBar.HORIZONTAL);
    toolBar.setFloatable(false);
    toolBar.setOpaque(true);
    toolBar.setBackground(new Color(154, 12, 12));
    toolBar.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 15));
    selectAllCB = new JCheckBox("Select All");
    selectAllCB.setVisible(false);
    selectAllCB.setForeground(Color.white);
    selectAllCB.addActionListener(this);
    refreshBut = new JButton(new ImageIcon(this.getClass().getResource("/images/reloadIcon.png")));
    refreshBut.setVisible(false);
    refreshBut.setToolTipText("Refresh");
    refreshBut.setForeground(new Color(20, 88, 49));
    refreshBut.addActionListener(this);
    backBut = new JButton(new ImageIcon(this.getClass().getResource("/images/backIcon.png")));
    backBut.setVisible(false);
    backBut.setToolTipText("Back");
    backBut.setForeground(new Color(20, 88, 49));
    backBut.addActionListener(this);
    deleteBut = new JButton(new ImageIcon(this.getClass().getResource("/images/trashIcon.png")));
    deleteBut.setToolTipText("Delete");
    deleteBut.setForeground(Color.red);
    deleteBut.setVisible(false);
    deleteBut.addActionListener(this);
    deleteBut.setBackground(Color.red);
    restoreBut = new JButton(new ImageIcon(this.getClass().getResource("/images/restoreIcon.png")));
    restoreBut.setToolTipText("Restore");
    restoreBut.setForeground(Color.blue);
    restoreBut.setVisible(false);
    restoreBut.addActionListener(this);
    toolBar.addSeparator(new Dimension(10, 5));
    toolBar.add(selectAllCB);
    toolBar.add(backBut);
    toolBar.add(refreshBut);
    toolBar.add(deleteBut);
    toolBar.add(restoreBut);
    add(toolBar, "North");
    JPanel centPan = new JPanel(new GridBagLayout());
    centPan.setBackground(new Color(52, 86, 70));
    JLabel label = new JLabel("Select A Category From Left Pane");
    label.setFont(new Font("arial", Font.BOLD, 35));
    label.setForeground(Color.yellow);
    centPan.add(label);
    contentPan = new JScrollPane(centPan);
    contentPan.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    add(contentPan, "Center");
    contentPan.repaint();

    db = new Database();
    //        inboxSet = db.getData("SELECT * FROM messages WHERE tag='inbox' ORDER BY msg_id
    // desc");
    //        sentmailSet = db.getData("SELECT * FROM messages WHERE tag='sentmail' ORDER BY msg_id
    // desc");
    //        draftSet = db.getData("SELECT * FROM messages WHERE tag='draft' ORDER BY msg_id
    // desc");
    //        outboxSet = db.getData("SELECT * FROM messages WHERE tag='outbox' ORDER BY msg_id
    // desc");
    //        trashSet = db.getData("SELECT * FROM messages,trash WHERE messages.tag='trash' and
    // messages.msg_id=trash.msg_id ORDER BY deleted_at desc");

  }
  /** Constructor for RestaurantGui class. Sets up all the gui components. */
  public RestaurantGui() {

    super("Restaurant Application");

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(50, 50, WINDOWX, WINDOWY);

    getContentPane().setLayout(new BoxLayout((Container) getContentPane(), BoxLayout.Y_AXIS));

    Dimension rest = new Dimension(WINDOWX, (int) (WINDOWY * .4));
    Dimension info = new Dimension(WINDOWX, (int) (WINDOWY * .1));
    restPanel.setPreferredSize(rest);
    restPanel.setMinimumSize(rest);
    restPanel.setMaximumSize(rest);
    infoPanel.setPreferredSize(info);
    infoPanel.setMinimumSize(info);
    infoPanel.setMaximumSize(info);
    infoPanel.setBorder(BorderFactory.createTitledBorder("Information"));

    inventorySetup.setLayout(new BorderLayout());
    inventorySetup.add(inventoryLabel, BorderLayout.NORTH);
    chicken.setMajorTickSpacing(1);
    chicken.setPaintLabels(true);
    chicken.setPaintTicks(true);
    steak.setMajorTickSpacing(1);
    steak.setPaintLabels(true);
    steak.setPaintTicks(true);
    pizza.setMajorTickSpacing(1);
    pizza.setPaintLabels(true);
    pizza.setPaintTicks(true);
    salad.setMajorTickSpacing(1);
    salad.setPaintLabels(true);
    salad.setPaintTicks(true);
    chicken.addChangeListener(this);
    steak.addChangeListener(this);
    pizza.addChangeListener(this);
    salad.addChangeListener(this);
    custHungerLevel.addChangeListener(this);
    currentChicken.setEditable(false);
    currentSteak.setEditable(false);
    currentSalad.setEditable(false);
    currentPizza.setEditable(false);

    moneyLabel.setText("New Customer Money");
    customerMoney.setEditable(true);
    custMoneyInput.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            custMoney = Integer.parseInt(customerMoney.getText());
          }
        });
    custMoneyInput.setText("submit");

    moneyPanel.setLayout(new GridLayout(1, 3));
    moneyPanel.add(moneyLabel);
    moneyPanel.add(customerMoney);
    moneyPanel.add(custMoneyInput);
    /*currentChicken.setText(Integer.toString(restPanel.cook.inventory.get("Chicken").currentNumber));
    currentSteak.setText(Integer.toString(restPanel.cook.inventory.get("Steak").currentNumber));
    currentPizza.setText(Integer.toString(restPanel.cook.inventory.get("Pizza").currentNumber));
    currentSalad.setText(Integer.toString(restPanel.cook.inventory.get("Salad").currentNumber));*/

    inventoryInput.setLayout(new GridLayout(5, 3));
    inventoryInput.add(chickenLabel);
    inventoryInput.add(currentChicken);
    inventoryInput.add(chicken);
    inventoryInput.add(saladLabel);
    inventoryInput.add(currentSalad);
    inventoryInput.add(salad);
    inventoryInput.add(pizzaLabel);
    inventoryInput.add(currentPizza);
    inventoryInput.add(pizza);
    inventoryInput.add(steakLabel);
    inventoryInput.add(currentSteak);
    inventoryInput.add(steak);
    inventoryInput.add(hungerLabel);
    inventoryInput.add(custHungerLevel);

    inventorySetup.add(inventoryInput, BorderLayout.CENTER);

    requestBreak.addActionListener(this);
    requestBreak.setVisible(false);

    stateCB.setVisible(false);
    stateCB.addActionListener(this);
    changeOrder.setVisible(false);
    changeOrder.addActionListener(this);

    infoPanel.setLayout(new GridLayout(1, 2, 30, 0));
    infoPanel.add(infoLabel);
    infoPanel.add(stateCB);
    infoPanel.add(requestBreak);
    infoPanel.add(changeOrder);

    getContentPane().add(restPanel);
    getContentPane().add(addTable);
    getContentPane().add(infoPanel);
    getContentPane().add(moneyPanel);
    getContentPane().add(inventorySetup);

    addTable.addActionListener(this);

    t.setDelay(40);
    t.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            updateInventory();
          }
        });
  }
示例#23
0
  /** Constructor for RestaurantGui class. Sets up all the gui components. */
  public RestaurantGui() {
    int WINDOWX = 600;
    int WINDOWY = 500;

    ButtonPanel = new JPanel();
    MrKrabs = new ImageIcon(getClass().getResource("/resources/MrKrabs.png"));
    Ramsay = new ImageIcon(getClass().getResource("/resources/Ramsay.png"));

    RestaurantPortion.setLayout(new BorderLayout());
    InformationPanel = new JPanel();
    InformationPanel.setLayout(new BorderLayout());
    buttonPanel = new JPanel();
    buttonPanel.setLayout(new BorderLayout());

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(25, 25, WINDOWX + 650, WINDOWY + 170);
    setVisible(true);

    setLayout(new BorderLayout());
    Dimension restDim = new Dimension(WINDOWX, (int) (WINDOWY * .86));
    restPanel.setPreferredSize(restDim);
    restPanel.setMinimumSize(restDim);
    restPanel.setMaximumSize(restDim);

    // pauseButton = new JButton("PAUSE");
    // pauseButton.addActionListener(this);
    refreshButton = new JButton("REFRESH");
    refreshButton.addActionListener(this);

    // CUSTOMER PANEL INFORMATION
    Dimension infoDimCustomer = new Dimension(WINDOWX, (int) (WINDOWY * .12));
    customerInformationPanel = new JPanel();
    customerInformationPanel.setPreferredSize(infoDimCustomer);
    customerInformationPanel.setMinimumSize(infoDimCustomer);
    customerInformationPanel.setMaximumSize(infoDimCustomer);
    customerInformationPanel.setBorder(BorderFactory.createTitledBorder("Customers"));

    customerStateCheckBox = new JCheckBox();
    customerStateCheckBox.setVisible(false);
    customerStateCheckBox.addActionListener(this);

    customerInformationPanel.setLayout(new GridLayout(1, 2, 30, 0));

    infoCustomerLabel = new JLabel();
    infoCustomerLabel.setText("<html><pre><i>There are no restaurant customers.</i></pre></html>");
    customerInformationPanel.add(infoCustomerLabel);
    customerInformationPanel.add(customerStateCheckBox);

    // WAITER PANEL INFORMATION/*
    /*
    Dimension infoDimWaiter = new Dimension(WINDOWX, (int) (WINDOWY * .12));
    waiterInformationPanel = new JPanel();
    waiterInformationPanel.setPreferredSize(infoDimWaiter);
    waiterInformationPanel.setMinimumSize(infoDimWaiter);
    waiterInformationPanel.setMaximumSize(infoDimWaiter);
    waiterInformationPanel.setBorder(BorderFactory.createTitledBorder("Waiters"));

    waiterON.addActionListener(this);
    waiterOFF.addActionListener(this);
    */
    // waiterInformationPanel.setLayout(new GridLayout(1, 2, 30, 0));

    infoWaiterLabel = new JLabel();
    infoWaiterLabel.setText("<html><pre><i>Click Add to make waiters</i></pre></html>");
    // waiterInformationPanel.add(infoWaiterLabel);
    waiterON.setVisible(false);
    waiterOFF.setVisible(false);
    // waiterInformationPanel.add(waiterON);
    // waiterInformationPanel.add(waiterOFF);
    RestaurantPortion.add(restPanel, BorderLayout.NORTH);
    InformationPanel.add(customerInformationPanel, BorderLayout.CENTER);
    MrKrabsButton = new JButton(MrKrabs);
    RamsayButton = new JButton(Ramsay);
    MrKrabsButton.addActionListener(this);
    RamsayButton.addActionListener(this);
    ButtonPanel.setLayout(new BorderLayout());
    ButtonPanel.add(MrKrabsButton, BorderLayout.WEST);
    ButtonPanel.add(RamsayButton, BorderLayout.EAST);
    InformationPanel.add(ButtonPanel, BorderLayout.SOUTH);
    // InformationPanel.add(waiterInformationPanel, BorderLayout.CENTER);
    RestaurantPortion.add(InformationPanel, BorderLayout.CENTER);
    // buttonPanel.add(pauseButton, BorderLayout.CENTER);
    buttonPanel.add(refreshButton, BorderLayout.CENTER);
    RestaurantPortion.add(buttonPanel, BorderLayout.SOUTH);

    add(animationPanel, BorderLayout.CENTER);
    add(RestaurantPortion, BorderLayout.EAST);
  }
 @Override
 public void setBatterieMonitorEnabled(final boolean visible) {
   _batteriMonitorCheckBox.setVisible(visible);
 }