Package javax.swing

Examples of javax.swing.JPanel


    mAvailableActions.insertElementAt(toolbarModel.getSeparatorAction(), 0);
    mAvailableActions.insertElementAt(toolbarModel.getGlueAction(), 1);
    mAvailableActions.insertElementAt(toolbarModel.getSpaceAction(), 2);

    // Initialize the Panel with the available Buttons
    mButtonPanel = new JPanel();
    mButtonPanel.setLayout(new GridLayout(0, 4, 2, 2));
    mButtonPanel.setAlignmentX(Component.LEFT_ALIGNMENT);


    // Make the buttonPanel scrollable
    JScrollPane pane = new JScrollPane(mButtonPanel);
    pane.setAlignmentX(Component.LEFT_ALIGNMENT);
    pane.getVerticalScrollBar().setUnitIncrement(73);
    pane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    addMouseAdapterForHandCursorToComponent(pane);

    // Initialize the Panel for selecting toolBars visibility
    final JPanel tVisPanel = new JPanel();
    tVisPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    tVisPanel.setLayout(new BoxLayout(tVisPanel, BoxLayout.X_AXIS));
    tVisPanel.setBorder(new CompoundBorder(BorderFactory.createMatteBorder(0,
        0, 1, 0, Color.GRAY), BorderFactory.createEmptyBorder(10, 5, 9, 5)));

    mShowToolbarCb = new JCheckBox(mLocalizer
        .msg("showToolbar", "Show toolbar"));
    mShowToolbarCb.setSelected(Settings.propIsToolbarVisible.getBoolean());

    tVisPanel.add(mShowToolbarCb);
    tVisPanel.add(Box.createHorizontalGlue());

    mShowSearchFieldCb = new JCheckBox(mLocalizer.msg("showSearchField",
        "Show Search field"));
    mShowSearchFieldCb.setSelected(Settings.propIsSearchFieldVisible
        .getBoolean());

    tVisPanel.add(mShowSearchFieldCb);

    // Initialize the panel for the ToolBar settings
    JPanel tSetPanel = new JPanel(new FormLayout("default,5dlu,default,0dlu:grow,default,5dlu,default,5dlu,default","default"));
    tSetPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    mLocationCB = new JComboBox(new String[] { mLocalizer.msg("top", "top"),
        Localizer.getLocalization(Localizer.I18N_LEFT), });

    if ("west".equals(Settings.propToolbarLocation.getString())) {
      mLocationCB.setSelectedIndex(1);
      mWest = true;
    } else {
      mWest = false;
    }

    mShowCB = new JComboBox(new String[] {
        ContextMenu.mLocalizer.msg("text.and.icon", "text and icon"),
        ContextMenu.mLocalizer.msg("text", "text"),
        ContextMenu.mLocalizer.msg("icon", "icon") });

    String style = Settings.propToolbarButtonStyle.getString();
    if ("text".equals(style)) {
      mShowCB.setSelectedIndex(1);
    } else if ("icon".equals(style)) {
      mShowCB.setSelectedIndex(2);
    }
    mShowCB.setAlignmentX(Component.CENTER_ALIGNMENT);
    mShowCB.setMaximumSize(mShowCB.getPreferredSize());

    mUseBigIconsCb = new JCheckBox(ContextMenu.mLocalizer.msg("bigIcons",
        "Use big icons"));
    mUseBigIconsCb.setSelected(Settings.propToolbarUseBigIcons.getBoolean());

    CellConstraints cc = new CellConstraints();

    tSetPanel.add(new JLabel(mLocalizer.msg("location", "Location")),cc.xy(1,1));
    tSetPanel.add(mLocationCB,cc.xy(3,1));
    tSetPanel.add(new JLabel(mLocalizer.msg("icons", "Icons")),cc.xy(5,1));
    tSetPanel.add(mShowCB,cc.xy(7,1));
    tSetPanel.add(mUseBigIconsCb,cc.xy(9,1));

    tSetPanel.setBorder(new CompoundBorder(BorderFactory.createMatteBorder(1,
        0, 1, 0, Color.GRAY), BorderFactory.createEmptyBorder(10, 5, 9, 5)));

    // The panel for the OK button
    JPanel okButtonPanel = new JPanel();
    okButtonPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    okButtonPanel.setLayout(new BoxLayout(okButtonPanel, BoxLayout.X_AXIS));
    okButtonPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 5, 5));

    JButton ok = new JButton("OK");
    ok.addActionListener(this);

    okButtonPanel.add(Box.createHorizontalGlue());
    okButtonPanel.add(ok);

    // Register ActionListener to the settings
    mShowToolbarCb.addActionListener(this);
    mShowSearchFieldCb.addActionListener(this);
    mShowCB.addActionListener(this);
View Full Code Here


              + c.getHeight() - 1);
        }
      }

      if (c != null) {
        JPanel toolBarPanel = MainFrame.getInstance().getToolBarPanel();

        Point p = SwingUtilities.convertPoint(toolBarPanel, location, c);

        Rectangle oldCueLineBounds = mCueLine.getBounds();

        if (mWest) {
          mCueLine.setRect(1,
              (p.y < c.getHeight() / 2) ? (location.y - p.y) : (location.y
                  + c.getHeight() - p.y), toolBarPanel.getWidth() - 1, 2);
        } else {
          mCueLine.setRect((p.x < c.getWidth() / 2) ? (location.x - p.x )
              : (location.x + c.getWidth() - p.x ), 1, 2,
              toolBarPanel.getHeight() - 1);
        }

        if (!oldCueLineBounds.equals(mCueLine.getBounds())) {
          Graphics2D g2d = (Graphics2D) toolBarPanel.getGraphics();
          toolBarPanel.paintImmediately(oldCueLineBounds);

          Color color = new Color(255, 0, 0, 180);
          g2d.setColor(color);
          g2d.fill(mCueLine);
View Full Code Here

      bit <<= 1;
    }
  }

  public JPanel getSettingsPanel() {
    final JPanel content = new JPanel(new BorderLayout());
    content.add(new JLabel(mLocalizer.msg("description",
        "This filter accepts programs belonging to the following channels:")),
        BorderLayout.NORTH);

    ArrayList<String> selectedDays = new ArrayList<String>();

    int bit = 1;
    for (int day = 0; day < 7; day++) {
      if ((mSelectedDays & bit) > 0) {
        selectedDays.add(allDays[day]);
      }
      bit <<= 1;
    }

    mList = new SelectableItemList(selectedDays.toArray(), allDays);
    content.add(mList, BorderLayout.CENTER);
    return content;
  }
View Full Code Here

  @Override
  public JPanel getSettingsPanel() {

    FormLayout layout = new FormLayout(
        "pref, 3dlu, fill:pref:grow, 3dlu, pref", "");
    JPanel content = new JPanel(layout);
    content.setBorder(Borders.DIALOG_BORDER);

    CellConstraints cc = new CellConstraints();
    int currentRow = 1;

    layout.appendRow(RowSpec.decode("pref"));
    layout.appendRow(RowSpec.decode("5dlu"));
    content.add(UiUtilities.createHelpTextArea(mLocalizer
        .msg("description", "")), cc.xyw(1, currentRow, 5));

    layout.appendRow(RowSpec.decode("pref"));
    layout.appendRow(RowSpec.decode("3dlu"));

    content.add(new JLabel(mLocalizer.msg("from.1", "From today plus")), cc.xy(
        1, currentRow += 2));
    mFromSpinner = new JSpinner(new SpinnerNumberModel(0, 0, 28, 1));
    mFromSpinner.setValue(mStartDays);
    content.add(mFromSpinner, cc.xy(3, currentRow));
    content.add(new JLabel(mLocalizer.msg("from.2", "days")), cc.xy(5,
        currentRow));

    layout.appendRow(RowSpec.decode("pref"));

    content.add(new JLabel(mLocalizer.msg("to.1", "Until today plus")), cc.xy(
        1, currentRow += 2));
    mToSpinner = new JSpinner(new SpinnerNumberModel(7, 0, 28, 1));
    mToSpinner.setValue(mEndDays);
    content.add(mToSpinner, cc.xy(3, currentRow));
    content.add(new JLabel(mLocalizer.msg("to.2", "days")), cc
        .xy(5, currentRow));

    JPanel centerPanel = new JPanel(new BorderLayout());
    centerPanel.add(content, BorderLayout.NORTH);
    return centerPanel;
  }
View Full Code Here

   *
   * @return the SettingsPanel
   */
  public JPanel createSettingsPanel() {
    mChannelListModel = new ChannelListModel();
    JPanel panel = new JPanel(new BorderLayout());

    JPanel northPn = new JPanel(new GridLayout(1, 2));
    JPanel centerPn = new JPanel(new GridLayout(1, 2));
    JPanel southPn = new JPanel(new BorderLayout());
    southPn.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));

    panel.add(northPn, BorderLayout.NORTH);
    panel.add(centerPn, BorderLayout.CENTER);
    panel.add(southPn, BorderLayout.SOUTH);

    mAvailableSeparator = DefaultComponentFactory.getInstance()
        .createSeparator(
            mLocalizer.msg("availableChannels", "Available channels") + ":");
    mAvailableSeparator.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 5));

    mSubscribedSeparator = DefaultComponentFactory.getInstance()
        .createSeparator(
            mLocalizer.msg("subscribedChannels", "Subscribed channels") + ":");
    mSubscribedSeparator.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 5));

    northPn.add(mAvailableSeparator, BorderLayout.NORTH);
    northPn.add(mSubscribedSeparator, BorderLayout.NORTH);

    // left list box
    JPanel listBoxPnLeft = new JPanel(new BorderLayout());
    mAllChannels = new ChannelJList(new DefaultListModel());
    mAllChannels.setCellRenderer(new ChannelListCellRenderer(true, true, true, true));

    listBoxPnLeft.add(new JScrollPane(mAllChannels), BorderLayout.CENTER);
/*
    mAllChannels.addListSelectionListener(new ListSelectionListener() {
      public void valueChanged(ListSelectionEvent e) {
        if ((mAllChannels.getModel().getSize() == 1)
            && (mAllChannels.getSelectedIndex() >= 0)
            && (mAllChannels.getSelectedValue() instanceof String)) {
          mAllChannels.setSelectedIndices(new int[] {});
        }
      }
    });
*/
    centerPn.add(listBoxPnLeft);

    mRightButton = new JButton(TVBrowserIcons.right(TVBrowserIcons.SIZE_LARGE));

    mRightButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        moveChannelsToRight();
      }
    });

    mLeftButton = new JButton(TVBrowserIcons.left(TVBrowserIcons.SIZE_LARGE));

    mLeftButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        moveChannelsToLeft();
      }
    });

    JPanel btnPanel = createButtonPn(mRightButton, mLeftButton);
    btnPanel.setBorder(BorderFactory.createEmptyBorder(0, Sizes
        .dialogUnitXAsPixel(3, btnPanel), 0, Sizes.dialogUnitXAsPixel(3,
        btnPanel)));
    listBoxPnLeft.add(btnPanel, BorderLayout.EAST);

    // right list box
    JPanel listBoxPnRight = new JPanel(new BorderLayout());
    SortableItemList channelList = new SortableItemList(new ChannelJList());

    mSubscribedChannels = channelList.getList();
    mFilter = new ChannelFilter();
    mSubscribedChannels.setCellRenderer(new FilteredChannelListCellRenderer(mFilter));

    // Register DnD on the lists.
    mDnDHandler = new ListDragAndDropHandler(mAllChannels, mSubscribedChannels, this);
    mDnDHandler.setPaintCueLine(false, true);

    // Register the listener for DnD on the lists.
    new DragAndDropMouseListener(mAllChannels, mSubscribedChannels, this,
        mDnDHandler);
    mSubscribedChannelListener = new DragAndDropMouseListener(
        mSubscribedChannels, mAllChannels, this, mDnDHandler);

    restoreForPopup();

    listBoxPnRight.add(new JScrollPane(mSubscribedChannels),
        BorderLayout.CENTER);

    final JButton configureChannels = new JButton(mLocalizer.msg(
        "configSelectedChannels", "Configure selected channels"));
    configureChannels.setEnabled(false);

    configureChannels.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        configChannels();
      }
    });

    mSubscribedChannels.addListSelectionListener(new ListSelectionListener() {
      public void valueChanged(ListSelectionEvent e) {
        if (mSubscribedChannels.getSelectedValues().length > 0) {
          configureChannels.setEnabled(true);
        } else {
          configureChannels.setEnabled(false);
        }
      }
    });

    // use INSERT key on left side to move selected channels to active channel
    // list
    mAllChannels.addKeyListener(new KeyAdapter() {
      public void keyPressed(KeyEvent e) {
        if (e.getKeyCode() == KeyEvent.VK_INSERT) {
          moveChannelsToRight();
        }
      }
    });

    // use DELETE key on right side to remove selected channels
    mSubscribedChannels.addKeyListener(new KeyAdapter() {
      public void keyPressed(KeyEvent e) {
        if (e.getKeyCode() == KeyEvent.VK_DELETE) {
          moveChannelsToLeft();
        }
      }
    });

    JPanel btnPanel2 = createButtonPn(channelList.getTopButton(), channelList
        .getUpButton(), channelList.getDownButton(), channelList
        .getBottomButton());
    btnPanel2.setBorder(BorderFactory.createEmptyBorder(0, Sizes
        .dialogUnitXAsPixel(3, btnPanel2), 0, 0));
    listBoxPnRight.add(btnPanel2, BorderLayout.EAST);

    centerPn.add(listBoxPnRight);

    final JPanel result = new JPanel(new BorderLayout());
    result.addComponentListener(new ComponentAdapter() {

      @Override
      public void componentHidden(ComponentEvent e) {
        if (e.getComponent() == result) {
          mRefreshListTimer = null;
        }
      }

    });

    result.add(createFilterPanel(), BorderLayout.NORTH);

    result.add(panel, BorderLayout.CENTER);

    LinkButton urlLabel = new LinkButton(
        mLocalizer
            .msg(
                "addMoreChannels",
                "You want to add your own channels? Click here!"),
        mLocalizer.msg("addMoreChannelsUrl",
            "http://enwiki.tvbrowser.org/index.php/Available_stations"));

    JPanel buttonsPanel = new JPanel(new BorderLayout());

    // buttonsPanel.add(pn2, BorderLayout.EAST);
    buttonsPanel.add(urlLabel, BorderLayout.SOUTH);

    result.add(buttonsPanel, BorderLayout.SOUTH);

    JButton refreshList = new JButton(mLocalizer.msg("updateChannelList",
        "Update channel list"), TVBrowserIcons.refresh(TVBrowserIcons.SIZE_SMALL));
View Full Code Here

   * Create the Panel with the Filter-Interface
   *
   * @return Panel with Filter Interface
   */
  private JPanel createFilterPanel() {
    JPanel filter = new JPanel(new FormLayout("fill:pref:grow",
        "pref, 3dlu, pref, 3dlu"));

    CellConstraints cc = new CellConstraints();

    JComponent filterSeparator = DefaultComponentFactory.getInstance()
        .createSeparator(
            mLocalizer.msg("channelFilter", "Channel Filter") + ":");
    filterSeparator.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));

    filter.add(filterSeparator, cc.xy(1, 1));

    JPanel filterPanel = new JPanel(new FormLayout(
        "pref, 3dlu, pref:grow, fill:60dlu, 3dlu, pref, 3dlu, pref:grow, pref",
        "pref, 3dlu, pref"));

    mCountryCB = new JComboBox();
    filterPanel.add(new JLabel(mLocalizer.msg("country", "Country") + ":"), cc
        .xy(1, 1));
    filterPanel.add(mCountryCB, cc.xyw(3, 1, 2));

    mCategoryCB = new JComboBox();
    mCategoryCB.setMaximumRowCount(20);

    filterPanel.add(new JLabel(mLocalizer.msg("category", "Category") + ":"),
        cc.xy(6, 1));
    filterPanel.add(mCategoryCB, cc.xyw(8, 1, 2));

    JPanel namePanel = new JPanel(new BorderLayout());

    namePanel.add(new JLabel(mLocalizer.msg("filterText",
        "With the following Text")
        + ": "), BorderLayout.WEST);

    mChannelName = new JTextField();
    namePanel.add(mChannelName, BorderLayout.CENTER);

    filterPanel.add(namePanel, cc.xyw(1, 3, 4));
    JButton reset = new JButton(mLocalizer.msg("reset", "Reset"));

    reset.addActionListener(new ActionListener() {
View Full Code Here

   * @param btn2
   *          Button 2
   * @return ButtonPanel
   */
  private JPanel createButtonPn(JButton btn1, JButton btn2) {
    JPanel result = new JPanel(new FormLayout("pref",
        "fill:pref:grow, pref, 3dlu, pref, fill:pref:grow"));

    CellConstraints cc = new CellConstraints();

    result.add(btn1, cc.xy(1, 2));
    result.add(btn2, cc.xy(1, 4));

    return result;
  }
View Full Code Here

   *          Button 2
   * @return ButtonPanel
   */
  private JPanel createButtonPn(JButton btn1, JButton btn2, JButton btn3,
      JButton btn4) {
    JPanel result = new JPanel(
        new FormLayout("pref",
            "fill:pref:grow, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref, fill:pref:grow"));

    CellConstraints cc = new CellConstraints();

    result.add(btn1, cc.xy(1, 2));
    result.add(btn2, cc.xy(1, 4));
    result.add(btn3, cc.xy(1, 6));
    result.add(btn4, cc.xy(1, 8));

    return result;
  }
View Full Code Here

    setTitle(mLocalizer.msg("title", "Mass-Filter Settings"));

    mForm = new SearchForm(false, false, false);
    mForm.setSearchFormSettings(mSearchFormSettings);

    JPanel content = (JPanel) getContentPane();

    content.setLayout(new BorderLayout());
    content.setBorder(Borders.DLU4_BORDER);

    content.add(mForm, BorderLayout.NORTH);

    JButton ok = new JButton(Localizer.getLocalization(Localizer.I18N_OK));
    ok.addActionListener(new ActionListener() {

      public void actionPerformed(ActionEvent e) {
        okPressed();
        setVisible(false);
      }

    });

    JButton cancel = new JButton(Localizer
        .getLocalization(Localizer.I18N_CANCEL));
    cancel.addActionListener(new ActionListener() {

      public void actionPerformed(ActionEvent e) {
        setVisible(false);
      }

    });

    JPanel buttons = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    buttons.add(ok);
    buttons.add(cancel);
    content.add(buttons, BorderLayout.SOUTH);

    pack();
  }
View Full Code Here

    return mPluginId;
  }

  public JPanel getSettingsPanel() {

    JPanel content = new JPanel(new BorderLayout(0, 7));
    JTextArea ta = new JTextArea(mLocalizer.msg("desc",
        "Accept all programs marked by plugin:"));
    ta.setLineWrap(true);
    ta.setWrapStyleWord(true);
    ta.setOpaque(false);
    ta.setEditable(false);
    ta.setFocusable(false);
    content.add(ta, BorderLayout.NORTH);

    PluginProxy[] plugins = PluginProxyManager.getInstance()
        .getActivatedPlugins();
    Arrays.sort(plugins, new PluginProxy.Comparator());

    mBox = new JComboBox(plugins);
    if (mPluginId != null) {
      PluginProxy plugin = PluginProxyManager.getInstance().getPluginForId(mPluginId);
      if (plugin != null) {
        mBox.setSelectedItem(plugin);
      }
    }
    content.add(mBox, BorderLayout.CENTER);

    JPanel centerPanel = new JPanel(new BorderLayout());
    centerPanel.add(content, BorderLayout.NORTH);
    return centerPanel;
  }
View Full Code Here

TOP

Related Classes of javax.swing.JPanel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.