Example #1
1
  public static void main(String[] args) {
    // String output;
    Ball BigBall = new Ball(5);
    JFrame frame1 = new JFrame();
    frame1.setTitle("Welcome to Ship!");
    frame1.setSize(300, 300);
    frame1.setLocation(200, 100);
    frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JComboBox<String> box = new JComboBox<String>(new String[] {"Casey", "Connolly", "Nielson"});
    JPanel panel = new JPanel();
    panel.add(box);
    frame1.add(panel);
    frame1.setVisible(true);

    TV tv1 = new TV();
    tv1.turnOn();
    tv1.setChannel(30);
    tv1.setVolume(3);

    System.out.println(tv1.toString());
    Stack stacker = new Stack();

    for (int i = 0; i < 10; i++) stacker.push(i);
    while (!stacker.empty()) System.out.println(stacker.pop() + " ");

    System.out.println(BigBall.toString());
    System.out.println("Finished");
  }
Example #2
0
 private JComponent makeTitledPanel(String title, JTree tree) {
   JPanel p = new JPanel(new BorderLayout());
   p.setBorder(BorderFactory.createTitledBorder(title));
   p.add(new JScrollPane(tree));
   tree.setRowHeight(0);
   return p;
 }
  /** Initializes the frame by creating its contents. */
  private void init() {
    setTitle("Validation Framework Test");
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    // Create content pane
    JPanel contentPane = new JPanel(new MigLayout("fill, wrap 1"));
    setContentPane(contentPane);

    // Tabbed pane
    JTabbedPane tabbedPane = new JTabbedPane();
    contentPane.add(tabbedPane, "grow");

    // Create tabs
    tabbedPane.add("Constant info", createTabConstantInfo());
    tabbedPane.add("Disabled", createTabDisabled());
    tabbedPane.add("Single validation", createTabSingleCompWithValidation());
    tabbedPane.add("Split pane", createTabSplitPane());
    tabbedPane.add("Scroll pane", createTabScrollPane());
    tabbedPane.add("Small panels", createTabSmallPanels());

    // Set size
    Dimension size = new Dimension(640, 480);
    setSize(size);

    // Set location
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    setLocation((screenSize.width - size.width) / 2, (screenSize.height - size.height) / 3);
  }
  private Component createTabDisabled() {
    JPanel panel = new JPanel(new MigLayout("fill, wrap 1"));

    final JTextField textField = new JTextField();
    final JCheckBox checkBox = new JCheckBox("Enabled");
    checkBox.setSelected(true);
    panel.add(checkBox);
    checkBox.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent actionEvent) {
            textField.setEnabled(checkBox.isSelected());
          }
        });

    panel.add(textField);
    textField.setColumns(15);

    on(new JTextFieldDocumentChangedTrigger(textField)) //
        .read(new JTextFieldTextProvider(textField)) //
        .check(new StringNotEmptyRule()) //
        .handleWith(new IconBooleanFeedback(textField, "Cannot be empty")) //
        .trigger();

    return panel;
  }
  /** procedure qui construit le satgePane */
  private void constructionStagePane() {

    // initialisation du stagePane
    stagePane = new JPanel();
    stagePane.setLayout(new GridLayout(0, 1, 20, 20));
    stagePane.setBackground(Color.WHITE);
  } // fin constructionStagePane()
Example #6
0
  public ActionFrame() {
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    buttonPanel = new JPanel();

    // define actions
    Action yellowAction = new ColorAction("Yellow", new ImagIcon("yellow-ball.gif"), Color.YELLOW);
    Action blueAction = new ColorAction("Blue", new ImageIcon("blue-ball.gif"), Color.BLUE);
    Action redAction = new ColorAction("Red", new ImageIcon("red-ball.gif"), Color.RED);

    // add buttons for these actions
    buttonPanel.add(new JButton(yellowAction));
    buttonPanel.add(new JButton(blueAction));
    buttonPanel.add(new JButton(recAction));

    // add panel to frame
    add(buttonPanel);

    // associate the Y, B, and R keys with names
    InputMap imap = buttonPanel.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    imap.put(KeyStroke.getKeyStroke("ctrl Y"), "panel.yellow");
    imap.put(KeyStroke.getKeyStroke("Ctrl B"), "panel.blue");
    imap.put(KeyStroke.getKeyStroke("ctrl R"), "panel.red");

    // associate the names with actions
    ActionMap amap = buttonPanel.getActionMap();
    amap.put("panel.yellow", yellowAction);
    amap.put("panel.blue", blueAction);
    amap.put("panel.red", redAction);
  }
Example #7
0
  private void setupDirectorySelection(JPanel panel) {
    JLabel lblScriptsDirectory = new JLabel(OStrings.getString("SCW_SCRIPTS_FOLDER"));
    panel.add(lblScriptsDirectory);

    m_txtScriptsDir = new JTextField();
    panel.add(m_txtScriptsDir);
    if (m_scriptsDirectory != null) {
      m_txtScriptsDir.setText(m_scriptsDirectory.getPath());
    }

    m_txtScriptsDir.setColumns(40);
    m_txtScriptsDir.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            directoryTextFieldActionPerformed(evt);
          }
        });

    JButton btnBrowse = new JButton();
    Mnemonics.setLocalizedText(btnBrowse, OStrings.getString("SCW_SCRIPTS_FOLDER_CHOOSE"));
    btnBrowse.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            directoryChooserButtonActionPerformed(evt);
          }
        });

    panel.add(btnBrowse);
  }
  private SoundObjectEditorTopComponent() {
    initComponents();
    setName(
        NbBundle.getMessage(
            SoundObjectEditorTopComponent.class, "CTL_SoundObjectEditorTopComponent"));
    setToolTipText(
        NbBundle.getMessage(
            SoundObjectEditorTopComponent.class, "HINT_SoundObjectEditorTopComponent"));
    //        setIcon(Utilities.loadImage(ICON_PATH, true));
    emptyPanel.setMinimumSize(new Dimension(0, 0));
    this.setLayout(new BorderLayout());
    editPanel.setLayout(cardLayout);
    this.add(editPanel, BorderLayout.CENTER);
    editPanel.add(emptyPanel, "none");

    ArrayList<BluePlugin> plugins =
        BluePluginManager.getInstance().getPlugins(SoundObjectEditor.class);

    for (BluePlugin plugin : plugins) {
      sObjEditorMap.put(
          (Class) plugin.getProperty(BluePlugin.PROP_EDIT_CLASS), plugin.getPluginClass());
    }

    setEditingLibraryObject(null);

    SoundObjectSelectionBus.getInstance().addSelectionListener(this);

    selectionPerformed(SoundObjectSelectionBus.getInstance().getLastSelectionEvent());
  }
  private void createContent() {
    content = new JPanel();
    content.setPreferredSize(new Dimension(200, 750));
    content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));

    this.add(content, BorderLayout.CENTER);
  }
  /** Arg Constructor */
  public TicTacToeFrame() {

    // Creates a panel for grid layout
    // http://www.java-tips.org/java-se-tips-100019/15-javax-swing/1751-how-to-make-split-pane-using-swing8.html
    JPanel gameBoardPanel = new JPanel(new GridLayout(3, 3, 0, 0)); // panel 1
    JPanel gameStatusPanel = new JPanel(); // panel 2

    // JLabel gameStatusLabel = new JLabel("Area 2");
    // gameBoardPanel.add(j1);
    gameStatusPanel.add(gameStatusLabel2);
    gameStatusPanel.add(gameStatusLabel3);
    gameStatusPanel.add(gameStatusLabel);
    JSplitPane splitPane =
        new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, gameBoardPanel, gameStatusPanel);
    splitPane.setResizeWeight(0.9);
    splitPane.setOneTouchExpandable(true);
    getContentPane().add(splitPane);

    // Adds 9 cells to grid layout
    for (int i = 0; i < 3; i++) {
      for (int k = 0; k < 3; k++) {
        gameBoardPanel.add(cells[i][k] = new Cell());
      }
    }
  }
Example #11
0
  /** Description of the Method */
  public void init() {
    // super.init();
    size = new Dimension(570, 570);
    contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(borderLayout1);

    Dimension d = messagePanel.getSize();
    d.height += 20;
    messagePanel.setPreferredSize(d);
    contentPane.add(messagePanel, BorderLayout.SOUTH);

    contentPane.setOpaque(true);
    userPanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(2, 2, 2, 2);

    messagePanel.setLayout(borderLayout5);
    contentPane.setOpaque(true);
    contentPane.setBackground(Color.white);
    this.setSize(size);

    messagePanel.add(labelMessage, BorderLayout.NORTH);
    // Logg.logg("MhClient: Före XttTree-skapande", 6);
    this.mhTable = new MhTable(root, false, this.labelMessage);
    // Logg.logg("MhClient: mhTable-skapande klart", 6);
    this.contentPane.add(this.mhTable.splitPane, BorderLayout.CENTER);
  }
  /**
   * Creates the geomerty input tabbed page
   *
   * @param tabbedPane The TabbedPane to add the tab to
   */
  private void getGeometryInput(JTabbedPane tabbedPane) {
    JPanel geometryInput = new JPanel(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridwidth = REMAINDER;
    gbc.fill = BOTH;
    gbc.anchor = NORTHWEST;
    gbc.weighty = 1.0;

    chainwheelGeometryInput.addContentChangeListener(this);
    geometryInput.add(chainwheelGeometryInput, gbc);

    sprocketGeometryInput.addContentChangeListener(this);
    geometryInput.add(sprocketGeometryInput, gbc);

    generalGeometryInput.addContentChangeListener(this);
    geometryInput.add(generalGeometryInput, gbc);

    driveTrainDrawing.addContentChangeListener(this);
    driveTrainOutput.addContentChangeListener(this);

    tabbedPane.addTab(
        Messages.getString("GeometryDetails"),
        null,
        geometryInput,
        Messages.getString("GeometryDetailsTip"));
  }
  JPanel makeLoadHypsPane() {
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(new JLabel("hi there"), BorderLayout.NORTH);

    return panel;
  }
  private void updateEditorText() {
    disposeNonTextEditor();

    final PsiElement elt = myElements[myIndex].getNavigationElement();
    Project project = elt.getProject();
    PsiFile psiFile = getContainingFile(elt);
    final VirtualFile vFile = psiFile.getVirtualFile();
    if (vFile == null) return;
    final FileEditorProvider[] providers =
        FileEditorProviderManager.getInstance().getProviders(project, vFile);
    for (FileEditorProvider provider : providers) {
      if (provider instanceof TextEditorProvider) {
        updateTextElement(elt);
        myBinarySwitch.show(myViewingPanel, TEXT_PAGE_KEY);
        break;
      } else if (provider.accept(project, vFile)) {
        myCurrentNonTextEditorProvider = provider;
        myNonTextEditor = myCurrentNonTextEditorProvider.createEditor(project, vFile);
        myBinaryPanel.removeAll();
        myBinaryPanel.add(myNonTextEditor.getComponent());
        myBinarySwitch.show(myViewingPanel, BINARY_PAGE_KEY);
        break;
      }
    }
  }
Example #15
0
  public void listeBoisson(JPanel onglet2) {
    // TODO Auto-generated method stub

    Object[][] donneesType = null;
    donneesType = mc.listTypeProduitBoisson();
    Object[][] donnees = null;
    donnees = mc.listProduitBoison();
    onglet2.removeAll();

    JButton[] tab_button = new JButton[donneesType.length];
    for (int i = 0; i < donneesType.length; i++) {
      tab_button[i] = new JButton();
      tab_button[i].setName((String) donneesType[i][0]);
      tab_button[i].setPreferredSize(dim);
      tab_button[i].setEnabled(false);
      tab_button[i].setIcon(new ImageIcon("images/" + (String) donneesType[i][0] + " nd.jpg"));

      // Ajout des boutons sur le panel et ajout des listener
      onglet2.add(tab_button[i]);
      for (int j = 0; j < donnees.length; j++) {
        if (donneesType[i][0].equals(donnees[j][0])) {
          // changer est mettre nouvelle image
          tab_button[i].addActionListener(new AjoutProduitVente());
          tab_button[i].setEnabled(true);
          tab_button[i].setIcon(new ImageIcon("images/" + (String) donneesType[i][0] + ".jpg"));
          // System.out.println("PASSER");
        }
      }
    }
  }
Example #16
0
  // constructor for duplicate boards
  // uses the solution board to generate proper hints
  public Puzzle(Board board, Board solution) {
    this.board = new Board(board);
    Board solutionBoard = solution;

    setLayout(new BorderLayout());

    // Plug in the top panel which will sit at the top
    this.topPanel = new PuzzleTop(solutionBoard, this.board, false);
    add(this.topPanel, BorderLayout.NORTH);

    // Add the sidebar to the second row
    this.sidebarPanel = new PuzzleSidebar(solutionBoard, this.board, false);
    add(this.sidebarPanel, BorderLayout.WEST);

    // Add the board panel to the second row
    this.boardPanel = new PuzzleBoard(this.board);
    boardLayout.add(this.boardPanel, BorderLayout.CENTER);

    // vertical drag
    PuzzleDragVertical verticalDragPanel = new PuzzleDragVertical(this.board, this);
    add(verticalDragPanel, BorderLayout.EAST);

    // horizontal drag
    PuzzleDragHorizontal horizontalDragPanel = new PuzzleDragHorizontal(this.board, this);
    boardLayout.add(horizontalDragPanel, BorderLayout.SOUTH);

    add(boardLayout, BorderLayout.CENTER);
  }
Example #17
0
  private void themeing() {

    aboutDialogLogger.entry();
    Color color = new Color(0, 0, 0, 0);

    mainPanel.setOpaque(false);
    mainPanel.setBackground(new Color(51, 181, 229));

    programLabel.setFont(new Font(programLabel.getFont().getName(), Font.BOLD, 24));

    displayPanel.setOpaque(false);

    licenseScrollPane.setOpaque(false);
    licenseScrollPane.getViewport().setOpaque(false);
    licenseScrollPane.setBorder(null);
    licenseScrollPane.setViewportBorder(null);
    licenseTextArea.setOpaque(false);
    licenseTextArea.setBackground(color);
    licenseTextArea.setEditable(false);

    developerScrollPane.setOpaque(false);
    developerScrollPane.getViewport().setOpaque(false);
    developerScrollPane.setBorder(null);
    developerScrollPane.setViewportBorder(null);
    developerPane.setOpaque(false);
    developerPane.setBackground(color);
    developerPane.setEditable(false);
    emptyPanel.setOpaque(false);
    aboutDialogLogger.exit(LoggerValues.SUCCESSFUL_EXIT);
  }
Example #18
0
  public void newframe() {
    JFrame frame = new JFrame("Cab Service ");
    frame.setSize(800, 600);

    frame.setVisible(true);
    // frame.setBackground(Color.CYAN);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JButton jb = new JButton("Set Name of Places ");
    jb.setBounds(100, 100, 20, 50);

    JPanel jp = new JPanel();
    jp.setBackground(Color.gray);
    jp.add(jb);
    frame.add(jp);
    JPanel jp1 = new JPanel();
    jp1.setBackground(Color.gray);
    frame.add(jp1);

    frame.add(jp);
    jb.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            try {
              CreateFrame();

            } catch (IOException ex) {
              Logger.getLogger(SetMap.class.getName()).log(Level.SEVERE, null, ex);
            }
          }
        });
  }
  private JPanel createBrowsePanel() {
    JPanel browsePanel = new JPanel(new BorderLayout());
    final JTextField directoryText = new JTextField();
    directoryText.setEditable(false);
    browsePanel.add(directoryText, BorderLayout.CENTER);
    JButton browseButton = new JButton("Browse...");
    browsePanel.add(browseButton, BorderLayout.EAST);

    browseButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JFileChooser chooser = new JFileChooser();
            chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            int retval = chooser.showSaveDialog(CreateThematicMapDialog.this);
            if (retval == JFileChooser.APPROVE_OPTION) {
              File selectedFile = chooser.getSelectedFile();
              directoryText.setText(selectedFile.getPath());
              evaluateFile = selectedFile;
            }
          }
        });

    Collections.<Component>addAll(evaluateEnablement, directoryText, browseButton);

    return browsePanel;
  }
Example #20
0
  public static void main(String[] args) {
    final Browser browser = new Browser();
    BrowserView browserView = new BrowserView(browser);

    final JTextField addressBar = new JTextField("http://www.teamdev.com/jxbrowser");
    addressBar.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            browser.loadURL(addressBar.getText());
          }
        });

    JPanel addressPane = new JPanel(new BorderLayout());
    addressPane.add(new JLabel(" URL: "), BorderLayout.WEST);
    addressPane.add(addressBar, BorderLayout.CENTER);

    JFrame frame = new JFrame("JxBrowser - Hello World");
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.add(addressPane, BorderLayout.NORTH);
    frame.add(browserView, BorderLayout.CENTER);
    frame.setSize(800, 500);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

    browser.loadURL(addressBar.getText());
  }
 private JComponent createRecentProjects() {
   JPanel panel = new JPanel(new BorderLayout());
   panel.add(new NewRecentProjectPanel(this), BorderLayout.CENTER);
   panel.setBackground(getProjectsBackground());
   panel.setBorder(new CustomLineBorder(getSeparatorColor(), JBUI.insetsRight(1)));
   return panel;
 }
  protected void initComponents() {
    activation = new JComboBox(new String[] {KEY_EQUIVALENT, TAB_TRIGGER});

    final CardLayout cardLayout = new CardLayout();
    activationSpec = new JPanel();
    activationSpec.setLayout(cardLayout);

    keyEquivalent = new JTextField();
    tabTrigger = new JTextField();
    name = new JTextField();

    activationSpec.add(keyEquivalent, KEY_EQUIVALENT);
    activationSpec.add(tabTrigger, TAB_TRIGGER);

    activation.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent itemEvent) {
            if (itemEvent.getStateChange() != ItemEvent.SELECTED) return;

            cardLayout.show(activationSpec, (String) itemEvent.getItem());
          }
        });

    scope = new JTextField();
  }
Example #23
0
  /**
   * Creates body of the dialog. You can redefine getDialogTitle(), getDescription(), getInputPane()
   * methods to customize this body.
   */
  protected final JPanel body() {
    final JPanel pane = new JPanel();
    pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
    final JEditorPane descPane =
        new JEditorPane(
            Tools.MIME_TYPE_TEXT_HTML,
            "<span style='font:bold italic;font-family:Dialog; font-size:"
                + Tools.getConfigData().scaled(14)
                + ";'>"
                + getDialogTitle()
                + "</span><br>"
                + "<span style='font-family:Dialog; font-size:"
                + Tools.getConfigData().scaled(12)
                + ";'>"
                + getDescription()
                + "</span>");
    descPane.setSize(300, Integer.MAX_VALUE);

    descPane.setBackground(Tools.getDefaultColor("ConfigDialog.Background"));
    descPane.setEditable(false);
    final JScrollPane descSP = new JScrollPane(descPane);
    descSP.setBorder(null);
    descSP.setAlignmentX(Component.LEFT_ALIGNMENT);
    descSP.setMinimumSize(new Dimension(0, 50));
    pane.add(descSP);
    final JComponent inputPane = getInputPane();
    if (inputPane != null) {
      inputPane.setMinimumSize(new Dimension(Short.MAX_VALUE, INPUT_PANE_HEIGHT));
      inputPane.setBackground(Tools.getDefaultColor("ConfigDialog.Background"));
      inputPane.setAlignmentX(Component.LEFT_ALIGNMENT);
      pane.add(inputPane);
    }
    pane.setBackground(Tools.getDefaultColor("ConfigDialog.Background.Light"));
    return pane;
  }
Example #24
0
  private void initWindow() {
    window.setIconImage(fsuicon);
    window.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    window.setResizable(false);
    window.setLocation(400, 400);
    window.setSize(400, 600);
    window.setLayout(null);
    window.add(mainPanel);
    mainPanel.setSize(395, 570);
    mainPanel.setLayout(null);
    mainPanel.setBackground(garnet);
    mainPanel.setBorder(BorderFactory.createLineBorder(gold, 10));

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

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

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

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

    buildGridPanel();
    buildMenuPanel();
  }
  public UpgradesPanel(ORUIManager orUIManager) {
    super(BoxLayout.Y_AXIS);

    this.orUIManager = orUIManager;

    preferredSize = new Dimension((int) Math.round(100 * (2 + Scale.getFontScale()) / 3), 200);
    setSize(preferredSize);
    setVisible(true);

    upgradePanel = new JPanel();

    upgradePanel.setOpaque(true);
    upgradePanel.setBackground(Color.DARK_GRAY);
    upgradePanel.setBorder(border);
    upgradePanel.setLayout(new GridLayout(defaultNbPanelElements, 1));

    scrollPane = new JScrollPane(upgradePanel);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setSize(getPreferredSize());

    doneButton.setActionCommand("Done");
    doneButton.setMnemonic(KeyEvent.VK_D);
    doneButton.addActionListener(this);
    cancelButton.setActionCommand("Cancel");
    cancelButton.setMnemonic(KeyEvent.VK_C);
    cancelButton.addActionListener(this);

    add(scrollPane);
  }
Example #26
0
    private JPanel makeAttributesPanel() {
      JPanel panel = new JPanel(new GridLayout(1, 2, 8, 8));
      panel.add(this.makePathAttributesPanel());
      panel.add(this.makeInteriorAttributesPanel());

      return panel;
    }
  private Component createTabSplitPane() {
    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);

    JPanel panel = new JPanel(new MigLayout("fill"));
    splitPane.setTopComponent(panel);
    JTextField textField = new JTextField();
    textField.setColumns(15);
    panel.add(textField);

    on(new JTextFieldDocumentChangedTrigger(textField)) //
        .read(new JTextFieldTextProvider(textField)) //
        .check(new StringNotEmptyRule()) //
        .handleWith(new IconBooleanFeedback(textField)) //
        .trigger();

    panel = new JPanel(new MigLayout("fill"));
    splitPane.setBottomComponent(panel);
    textField = new JTextField();
    textField.setColumns(15);
    panel.add(textField);

    on(new JTextFieldDocumentChangedTrigger(textField)) //
        .read(new JTextFieldTextProvider(textField)) //
        .check(new StringNotEmptyRule()) //
        .handleWith(new IconBooleanFeedback(textField)) //
        .trigger();

    return splitPane;
  }
Example #28
0
  /**
   * Creates a dialog that is showing the histogram for the given node (if null one is selected for
   * you)
   */
  private JPanel createNormalityTestDialog(Node selected) {
    DataSet dataSet = (DataSet) dataEditor.getSelectedDataModel();

    QQPlot qqPlot = new QQPlot(dataSet, selected);
    NormalityTestEditorPanel editorPanel = new NormalityTestEditorPanel(qqPlot, dataSet);

    JTextArea display =
        new JTextArea(
            NormalityTests.runNormalityTests(
                dataSet, (ContinuousVariable) qqPlot.getSelectedVariable()),
            20,
            65);
    display.setEditable(false);
    editorPanel.addPropertyChangeListener(new NormalityTestListener(display));

    Box box = Box.createHorizontalBox();
    box.add(display);

    box.add(Box.createHorizontalStrut(3));
    box.add(editorPanel);
    box.add(Box.createHorizontalStrut(5));
    box.add(Box.createHorizontalGlue());

    Box vBox = Box.createVerticalBox();
    vBox.add(Box.createVerticalStrut(15));
    vBox.add(box);
    vBox.add(Box.createVerticalStrut(5));

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(vBox, BorderLayout.CENTER);

    return panel;
  }
  /**
   * Show the specified wizard page
   *
   * @param index
   */
  private void showPage(Integer index, Direction dir) {
    AbstractWizardPanel page;
    try {
      page = pages.get(index);
    } catch (Exception e) {
      log.error("Error setting wizard page to index: " + index);
      e.printStackTrace();
      return;
    }

    // Check to see if page should be ignored
    if (isIgnoredPageClass(page)) {
      if (dir.equals(Direction.FORWARD)) {
        index++;
      } else {
        index--;
      }

      showPage(index, dir);
      return;
    }

    pagePanel.removeAll();
    pagePanel.add(page);
    lblTitle.setText(page.getTitle());
    txtInstructions.setText(page.getInstructions());
    currPageIndex = index;
    autoEnableNavButtons();

    page.initialViewTasks();

    pagePanel.repaint();
  }
Example #30
0
  /**
   * Adds a new tab to the download dialog in JOSM.
   *
   * <p>This method is, for all intents and purposes, the constructor for this class.
   */
  @Override
  public void addGui(final DownloadDialog gui) {
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(buildSearchPanel(), BorderLayout.NORTH);

    DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();
    model = new NamedResultTableModel(selectionModel);
    columnmodel = new NamedResultTableColumnModel();
    tblSearchResults = new JTable(model, columnmodel);
    tblSearchResults.setSelectionModel(selectionModel);
    JScrollPane scrollPane = new JScrollPane(tblSearchResults);
    scrollPane.setPreferredSize(new Dimension(200, 200));
    panel.add(scrollPane, BorderLayout.CENTER);

    gui.addDownloadAreaSelector(panel, tr("Areas around places"));

    scrollPane.setPreferredSize(scrollPane.getPreferredSize());
    tblSearchResults.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    tblSearchResults.getSelectionModel().addListSelectionListener(new ListSelectionHandler());
    tblSearchResults.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() > 1) {
              SearchResult sr = model.getSelectedSearchResult();
              if (sr == null) return;
              parent.startDownload(sr.getDownloadArea());
            }
          }
        });
    parent = gui;
  }