Package com.jgoodies.forms.builder

Examples of com.jgoodies.forms.builder.PanelBuilder


  /**
   * Creates the settings panel for this tab.
   */
  public JPanel createSettingsPanel() {
    CellConstraints cc = new CellConstraints();
    PanelBuilder pb = new PanelBuilder(new FormLayout("5dlu, default:grow, 5dlu",
    "default,5dlu,default,default,default,5dlu,default,10dlu,default,5dlu,default,default,default"));
    pb.setDefaultDialogBorder();

    pb.addSeparator(mLocalizer.msg("programTable","Program table"), cc.xyw(1,1,3));
    pb.add(mShowIconAndNameInProgramTable = new JRadioButton(mLocalizer.msg("showIconAndName","Show channel icon and channel name"), Settings.propShowChannelIconsInProgramTable.getBoolean() && Settings.propShowChannelNamesInProgramTable.getBoolean()), cc.xy(2,3));
    pb.add(mShowOnlyIconInProgramTable = new JRadioButton(mLocalizer.msg("showOnlyIcon","Show channel icon"), Settings.propShowChannelIconsInProgramTable.getBoolean() && !Settings.propShowChannelNamesInProgramTable.getBoolean()), cc.xy(2,4));
    pb.add(mShowOnlyNameInProgramTable = new JRadioButton(mLocalizer.msg("showOnlyName","Show channel name"), Settings.propShowChannelNamesInProgramTable.getBoolean() && !Settings.propShowChannelIconsInProgramTable.getBoolean()), cc.xy(2,5));
    pb.add(mShowTooltipInProgramTable = new JCheckBox(mLocalizer.msg("showToolTip","Show large channel icons in tooltip"), Settings.propShowChannelTooltipInProgramTable.getBoolean()), cc.xy(2,7));

    mShowTooltipInProgramTable.setEnabled(!mShowOnlyNameInProgramTable.isSelected());
   
    mShowOnlyNameInProgramTable.addItemListener(new ItemListener() {
      public void itemStateChanged(ItemEvent e) {
        mShowTooltipInProgramTable.setEnabled(e.getStateChange() == ItemEvent.DESELECTED);
      }
    });
   
    ButtonGroup programTable = new ButtonGroup();
    programTable.add(mShowIconAndNameInProgramTable);
    programTable.add(mShowOnlyIconInProgramTable);
    programTable.add(mShowOnlyNameInProgramTable);
   
    pb.addSeparator(mLocalizer.msg("channelLists","Channel lists"), cc.xyw(1,9,3));
    pb.add(mShowIconAndNameInChannelLists = new JRadioButton(mLocalizer.msg("showIconAndName","Show channel icon and channel name"), Settings.propShowChannelIconsInChannellist.getBoolean() && Settings.propShowChannelNamesInChannellist.getBoolean()), cc.xy(2,11));
    pb.add(mShowOnlyIconInChannelLists = new JRadioButton(mLocalizer.msg("showOnlyIcon","Show channel icon"), Settings.propShowChannelIconsInChannellist.getBoolean() && !Settings.propShowChannelNamesInChannellist.getBoolean()), cc.xy(2,12));
    pb.add(mShowOnlyNameInChannelLists = new JRadioButton(mLocalizer.msg("showOnlyName","Show channel name"), Settings.propShowChannelNamesInChannellist.getBoolean() && !Settings.propShowChannelIconsInChannellist.getBoolean()), cc.xy(2,13));

    ButtonGroup channelLists = new ButtonGroup();
    channelLists.add(mShowIconAndNameInChannelLists);
    channelLists.add(mShowOnlyIconInChannelLists);
    channelLists.add(mShowOnlyNameInChannelLists);
   
    return pb.getPanel();
  }
View Full Code Here


  public String getTitle() {
    return mLocalizer.msg("general", "General");
  }

  private JPanel createRefreshPanel() {
    PanelBuilder refreshSettings = new PanelBuilder(new FormLayout("5dlu, 9dlu, pref, 3dlu, pref, fill:3dlu:grow, 3dlu",
    "pref, 5dlu, pref, 3dlu, pref, pref, 3dlu, pref, 5dlu, pref, 3dlu, pref"));

    CellConstraints cc = new CellConstraints();

    refreshSettings.addSeparator(mLocalizer.msg("titleRefresh", "Startup"), cc.xyw(
        1, 1, 6));

    mAutoDownload = new JCheckBox(mLocalizer.msg("autoUpdate","Update TV listings automatically"));

    mStartDownload = new JRadioButton(mLocalizer.msg("onStartUp", "Only on TV-Browser startup"));
    mRecurrentDownload = new JRadioButton(mLocalizer.msg("recurrent","Recurrent"));

    ButtonGroup bg = new ButtonGroup();

    bg.add(mStartDownload);
    bg.add(mRecurrentDownload);

    refreshSettings.add(mAutoDownload, cc.xyw(2, 3, 5));

    refreshSettings.add(mStartDownload, cc.xyw(3, 5, 4));
    refreshSettings.add(mRecurrentDownload, cc.xyw(3, 6, 4));

    mAutoDownloadCombo = new JComboBox(AUTO_DOWNLOAD_MSG_ARR);
    String dlType = Settings.propAutoDownloadType.getString();
    if (dlType.equals("daily")) {
      mAutoDownloadCombo.setSelectedIndex(0);
    } else if (dlType.equals("every3days")) {
      mAutoDownloadCombo.setSelectedIndex(1);
    } else if (dlType.equals("weekly")) {
      mAutoDownloadCombo.setSelectedIndex(2);
    }

    JPanel panel = new JPanel(new FormLayout("10dlu, pref, 3dlu, pref", "pref, 3dlu, pref, 3dlu, pref, 5dlu, pref"));

    mStartDownload.setSelected(!dlType.equals("never") && !Settings.propAutoDataDownloadEnabled.getBoolean());
    mRecurrentDownload.setSelected(Settings.propAutoDataDownloadEnabled.getBoolean());

    mAutoDownload.setSelected(mStartDownload.isSelected() || mRecurrentDownload.isSelected());
    mStartDownload.setSelected(!mAutoDownload.isSelected() || mStartDownload.isSelected());

    mStartDownload.setEnabled(mAutoDownload.isSelected());
    mRecurrentDownload.setEnabled(mAutoDownload.isSelected());

    mHowOften = new JLabel(mLocalizer.msg("autoDownload.howOften", "How often?"));
    panel.add(mHowOften, cc.xy(2, 1));
    panel.add(mAutoDownloadCombo, cc.xy(4, 1));

    mAskBeforeDownloadRadio = new JRadioButton(mLocalizer.msg("autoDownload.ask", "Ask before downloading"));
    mAutoDownloadPeriodCB = new JComboBox(PeriodItem.getPeriodItems());

    int autoDLPeriod = Settings.propAutoDownloadPeriod.getInt();
    PeriodItem pi = new PeriodItem(autoDLPeriod);
    mAutoDownloadPeriodCB.setSelectedItem(pi);

    panel.add(mAskBeforeDownloadRadio, cc.xyw(2, 3, 3));

    mAskTimeRadio = new JRadioButton(mLocalizer.msg("autoDownload.duration", "Automatically refresh for"));
    panel.add(mAskTimeRadio, cc.xy(2, 5));
    panel.add(mAutoDownloadPeriodCB, cc.xy(4, 5));

    ButtonGroup group = new ButtonGroup();
    group.add(mAskBeforeDownloadRadio);
    group.add(mAskTimeRadio);

    mAskBeforeDownloadRadio.setSelected(Settings.propAskForAutoDownload.getBoolean());
    mAskTimeRadio.setSelected(!Settings.propAskForAutoDownload.getBoolean());

    mAutoDownloadWaitingTime = new JCheckBox(mLocalizer.msg("autoDownload.waiting","Delay auto update for"),Settings.propAutoDownloadWaitingEnabled.getBoolean());
    mAutoDownloadWaitingTimeSp = new JSpinner(new SpinnerNumberModel(
        Settings.propAutoDownloadWaitingTime.getShort(), 1, 60, 1));
    mSecondsLabel = new JLabel(mLocalizer.msg("autoDownload.seconds","seconds"));

    mAutoDownload.addItemListener(new ItemListener() {
      public void itemStateChanged(ItemEvent e) {
        setAutoDownloadEnabled(e.getStateChange() == ItemEvent.SELECTED);
      }
    });

    mAskBeforeDownloadRadio.addItemListener(new ItemListener() {
      public void itemStateChanged(ItemEvent e) {
        setAutoDownloadEnabled(mAutoDownload.isSelected());
      }
    });

    mAskTimeRadio.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        setAutoDownloadEnabled(mAskTimeRadio.isSelected());
      };
    });

    mAutoDownloadWaitingTime.addItemListener(new ItemListener() {
      public void itemStateChanged(ItemEvent e) {
        mAutoDownloadWaitingTimeSp.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
      }
    });

    JPanel waitingPanel = new JPanel(new FormLayout("pref,2dlu,pref,2dlu,pref","pref"));

    waitingPanel.add(mAutoDownloadWaitingTime, cc.xy(1, 1));
    waitingPanel.add(mAutoDownloadWaitingTimeSp, cc.xy(3, 1));
    waitingPanel.add(mSecondsLabel, cc.xy(5,1));

    panel.add(waitingPanel, cc.xyw(1,7,4));

    refreshSettings.add(panel, cc.xyw(3, 8, 4));

    mDateCheck = new JCheckBox(mLocalizer.msg("checkDate", "Check date via NTP if data download fails"));
    mDateCheck.setSelected(Settings.propNTPTimeCheck.getBoolean());

    refreshSettings.add(mDateCheck, cc.xyw(2, 10, 5));

    mShowFinishDialog = new JCheckBox(mLocalizer.msg("showFinishDialog", "Show dialog when update is done"));
    mShowFinishDialog.setSelected(!Settings.propHiddenMessageBoxes.containsItem("downloadDone"));

    refreshSettings.add(mShowFinishDialog, cc.xyw(2, 12, 5));

    setAutoDownloadEnabled(mAutoDownload.isSelected());

    return refreshSettings.getPanel();
  }
View Full Code Here

  protected JPanel createContent(WizardHandler handler) {

    mNameTf = new JTextField(((Favorite)handler.getCurrentValue()).getName());


    PanelBuilder panelBuilder = new PanelBuilder(new FormLayout("5dlu, pref, 3dlu, default:grow",
        "pref"));
    panelBuilder.setBorder(Borders.DLU4_BORDER);
    CellConstraints cc = new CellConstraints();
    panelBuilder.add(new JLabel(mLocalizer.msg("saveAs", "Save as:")), cc.xy(2,1));
    panelBuilder.add(mNameTf, cc.xy(4,1));

    JPanel panel = panelBuilder.getPanel();
    panel.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent e) {
          mNameTf.requestFocusInWindow();
        }
      });
View Full Code Here

    ini();
  }

  // Added method for building up the search bar
  private void ini() {
    PanelBuilder b = new PanelBuilder(new FormLayout(
        "2dlu,pref,5dlu,pref,5dlu,100dlu,5dlu,pref,5dlu,pref,15dlu,pref",
        "pref,3dlu"));
    CellConstraints cc = new CellConstraints();

    mSearchBar = b.getPanel();
    mSearchBar.addComponentListener(this);
    mSearchBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, mSearchBar.getBackground().darker()));

    mSearchCloseBtn = new JButton(IconLoader.getInstance()
        .getIconFromTheme("actions", "process-stop", 16));
    mSearchCloseBtn.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    mSearchCloseBtn.setPressedIcon(IconLoader.getInstance().getIconFromTheme(
        "actions", "close-pressed", 16));
    mSearchCloseBtn.setToolTipText(mLocalizer.msg("closeToolTip",
        "Close Find bar"));
    mSearchCloseBtn.setContentAreaFilled(false);
    mSearchCloseBtn.setFocusable(false);
   
    MouseListener[] ml = mSearchCloseBtn.getMouseListeners();
   
    for(int i = 0; i < ml.length; i++) {
      if(!(ml[i] instanceof ToolTipManager)) {
        mSearchCloseBtn.removeMouseListener(ml[i]);
      }
    }

    final JTextField searchField = getSearchField();

    mFindNext = new JButton(mLocalizer.msg("next", "Find Next"));
    mFindNext.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    mFindNext.setIcon(TVBrowserIcons.down(TVBrowserIcons.SIZE_SMALL));
    mFindNext.setContentAreaFilled(false);
    mFindNext.setFocusable(false);
    mFindNext.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        next();
      }
    });

    mFindPrev = new JButton(mLocalizer.msg("prev", "Find Previous"));
    mFindPrev.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    mFindPrev.setIcon(TVBrowserIcons.up(TVBrowserIcons.SIZE_SMALL));
    mFindPrev.setContentAreaFilled(false);
    mFindPrev.setFocusable(false);
    mFindPrev.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        prev();
      }
    });

    addMouseAdapter(mFindNext);
    addMouseAdapter(mFindPrev);
    addMouseAdapter(mSearchCloseBtn);

    searchField.addKeyListener(new KeyAdapter() {
      public void keyReleased(KeyEvent e) {
        mFindNext.setEnabled(searchField.getText().length() > 0);
        mFindPrev.setEnabled(searchField.getText().length() > 0);
      }
    });

    b.add(mSearchCloseBtn, cc.xy(2, 1));
    b.addLabel(mLocalizer.msg("find", "Find:"), cc.xy(4, 1));
    b.add(searchField, cc.xy(6, 1));
    b.add(mFindNext, cc.xy(8, 1));
    b.add(mFindPrev, cc.xy(10, 1));
    b.add(getMessageLabel(), cc.xy(12, 1));

    /*
     * Close action for the SearchPanel.
     */
    Action close = new AbstractAction() {
View Full Code Here

   * Create the GUI
   */
  private void createGui() {
    try {
      CellConstraints cc = new CellConstraints();
      PanelBuilder pb = new PanelBuilder(new FormLayout("5dlu,default:grow,5dlu",
          "pref,5dlu,fill:default:grow,5dlu,pref"), (JPanel) this.getContentPane());
      pb.setDefaultDialogBorder();

      mConfigPanel = new PluginProgramConfigurationPanel(CalendarExportPlugin.getInstance()
          .getSelectedPluginProgramFormattings(), CalendarExportPlugin.getInstance()
          .getAvailableLocalPluginProgramFormatings(), CalendarExportPlugin.getDefaultFormatting(), true, false);

      pb.addSeparator(mLocalizer.msg("title", "Formatings selection"), cc.xyw(1, 1, 3));
      pb.add(mConfigPanel, cc.xy(2, 3));

      FormLayout layout = new FormLayout("0dlu:grow,pref,5dlu,pref", "pref");
      layout.setColumnGroups(new int[][] { { 2, 4 } });

      JPanel buttonPanel = new JPanel(layout);

      JButton ok = new JButton(Localizer.getLocalization(Localizer.I18N_OK));

      ok.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          okPressed();
        }
      });

      JButton cancel = new JButton(Localizer.getLocalization(Localizer.I18N_CANCEL));
      cancel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          cancelPressed();
        }
      });

      buttonPanel.add(ok, cc.xy(2, 1));
      buttonPanel.add(cancel, cc.xy(4, 1));

      pb.add(buttonPanel, cc.xy(2, 5));

      getRootPane().setDefaultButton(ok);

      setSize(550, 400);
    } catch (Exception e) {
View Full Code Here

    /**
     * creates a JPanel for getting the time offsets
     */
    private void createPanel() {
      CellConstraints cc = new CellConstraints();
      PanelBuilder pb = new PanelBuilder(new FormLayout("5dlu,12dlu,pref:grow,5dlu,pref:grow,5dlu",
      "pref,5dlu,pref,1dlu,pref,10dlu,pref,5dlu,pref,1dlu,"+
      "pref,10dlu,pref,5dlu,pref,1dlu,pref,7dlu,pref,pref," +
      "pref,pref,pref,7dlu,pref,pref,10dlu,pref"),this);
      pb.setDefaultDialogBorder();
     
      mPreTimeSpinner = new JSpinner(new SpinnerNumberModel(mData.getPreTime(), 0, null, 1));
      mPostTimeTextField = new JSpinner(new SpinnerNumberModel(mData.getPostTime(), 0, null, 1));
     
      mUserName.setText(mData.getUsername());
      mUserPwd.setText(mData.getPassword());
     
      mMaxSimult = new JSpinner(new SpinnerNumberModel(mData.getMaxSimultanious(), 1, null, 1));
      mMaxTimeout = new JSpinner(new SpinnerNumberModel(mData.getTimeout(), -1, 999, 1));

      mCheckReturn = new JCheckBox(mLocalizer.msg("CheckError", "Check if returns Error"), mData.useReturnValue());
      mShowOnError = new JCheckBox(mLocalizer.msg("ShowResultOnError","Show Result-Dialog only on Error"), mData.getDialogOnlyOnError());
      mShowTitleAndTimeDialog = new JCheckBox(mLocalizer.msg("showTitleAndTime", "Show title and time settings dialog"), mData.getShowTitleAndTimeDialog());
      mDeleteRemovedPrograms = new JCheckBox(mLocalizer.msg("autoDeletePrograms", "Automatically delete programs that were removed during a data update"), mData.getDeleteRemovedPrograms());
      mOldPrograms = new JCheckBox(mLocalizer.msg("OnlyFuture", "Only allow Programs that are in the future"), mData.getOnlyFuturePrograms());
     
      mUseTime = new JCheckBox(mLocalizer.msg("useSystemTimezone","Use timezone provided by OS"), !mData.useTimeZone());
     
      String[] zoneIds = new String[0];
      try {
        zoneIds = TimeZone.getAvailableIDs();
      } catch (Exception e) {
        e.printStackTrace();
      }
      mTimeZones = new JComboBox(zoneIds);
      mTimeZones.setEnabled(mData.useTimeZone() && mTimeZones.getItemCount() > 0);
     
      for (int i=0; i<zoneIds.length; i++) {
        if (zoneIds[i].equals(mData.getTimeZone().getID())) {
          mTimeZones.setSelectedIndex(i); break;
        }
      }
     
      pb.addSeparator(mLocalizer.msg("TimeSettings", "Timesettings"), cc.xyw(1,1,6));
     
      pb.addLabel(mLocalizer.msg("Earlier", "Number of minutes to start erlier"),cc.xyw(2,3,2));
      pb.add(mPreTimeSpinner, cc.xy(5,3));
     
      pb.addLabel(mLocalizer.msg("Later", "Number of minutes to stop later"),cc.xyw(2,5,2));
      pb.add(mPostTimeTextField, cc.xy(5,5));
     
      pb.addSeparator(mLocalizer.msg("User", "User"), cc.xyw(1,7,6));
     
      pb.addLabel(mLocalizer.msg("Username", "Username") + ":", cc.xyw(2,9,2));
      pb.add(mUserName, cc.xy(5,9));
     
      pb.addLabel(mLocalizer.msg("Password", "Password") + ":", cc.xyw(2,11,2));
      pb.add(mUserPwd, cc.xy(5,11));
           
      pb.addSeparator(mLocalizer.msg("Additional", "Additional"), cc.xyw(1,13,6));

      pb.addLabel(mLocalizer.msg("MaxSimult","Maximum simultaneous recordings")+ ":" , cc.xyw(2,15,2));
      pb.add(mMaxSimult,cc.xy(5,15));
     
      pb.addLabel(mLocalizer.msg("Timeout","Wait sec. until Timeout (-1 = disabled)")+ ":", cc.xyw(2,17,2));
      pb.add(mMaxTimeout,cc.xy(5,17));

      pb.add(mCheckReturn, cc.xyw(2,19,4));
      pb.add(mShowOnError, cc.xyw(2,20,4));
      pb.add(mShowTitleAndTimeDialog, cc.xyw(2,21,4));
      pb.add(mDeleteRemovedPrograms, cc.xyw(2,22,4));
      pb.add(mOldPrograms, cc.xyw(2,23,4));
     
      pb.add(mUseTime, cc.xyw(2,25,4));
     
      JPanel timeZonePanel = new JPanel(new FlowLayout(FlowLayout.LEFT,0,0));
      mTimeZoneLabel = new JLabel(mLocalizer.msg("Timezone","Timezone")+": ");
      mTimeZoneLabel.setEnabled(mTimeZones.isEnabled());
      timeZonePanel.add(mTimeZoneLabel);
      timeZonePanel.add(mTimeZones);
     
      pb.add(timeZonePanel, cc.xyw(3,26,3));
     
      mProgramReceiveTargetSelection = new ProgramReceiveTargetSelectionPanel(UiUtilities.getLastModalChildOf(CapturePlugin.getInstance().getSuperFrame()),
          mData.getProgramReceiveTargets(),null,CapturePlugin.getInstance(),true,mLocalizer.msg("sendToTitle","Send scheduled programs to:"));
      mProgramReceiveTargetSelection.addChangeListener(this);
      pb.add(mProgramReceiveTargetSelection, cc.xyw(1,28,5));
     
      // add ChangeListener to the spinners
      mPreTimeSpinner.addChangeListener(this);
      mPostTimeTextField.addChangeListener(this);
      mMaxSimult.addChangeListener(this);
View Full Code Here

    /**
     * creates a JPanel for managing the channels
     */
    private void createPanel() {
      CellConstraints cc = new CellConstraints();
      PanelBuilder pb = new PanelBuilder(new FormLayout("5dlu,pref:grow,5dlu","pref,5dlu,fill:default:grow"),this);
      pb.setDefaultDialogBorder();

      ChannelTableModel tableModel = new ChannelTableModel(mData);
      mChannelTable.setModel(tableModel);
      mChannelTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
      mChannelTable.getTableHeader().setReorderingAllowed(false);
      mChannelTable.getColumnModel().getColumn(0).setCellRenderer(new ChannelTableCellRenderer());
      mChannelTable.getColumnModel().getColumn(1).setCellRenderer(new DefaultTableCellRenderer() {
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
          JPanel background = new JPanel(new FormLayout("default:grow","fill:default:grow"));
          JLabel label = new JLabel(value.toString());
          label.setOpaque(false);
         
          if(isSelected) {
            background.setBackground(table.getSelectionBackground());
            label.setForeground(table.getSelectionForeground());
          }
          else {
            background.setBackground(table.getBackground());
          }
         
          background.add(label, new CellConstraints().xy(1,1));
         
          return background;
        }
      });
     
      JScrollPane sp = new JScrollPane(mChannelTable);

      addAncestorListener(new AncestorListener() {
        public void ancestorAdded(AncestorEvent event) {}

        public void ancestorMoved(AncestorEvent event) {}

        public void ancestorRemoved(AncestorEvent event) {
          if (mChannelTable.isEditing()) {
            TableCellEditor editor = mChannelTable.getCellEditor();
            if (editor != null) {
              editor.stopCellEditing();
            }
          }
        }
      });
       
      pb.addSeparator(mLocalizer.msg("ChannelNames", "Channel Names"), cc.xyw(1,1,3));
      pb.add(sp, cc.xy(2,3));
    }
View Full Code Here

    /**
     * creates a JPanel for getting the programpath
     */
    private void createPanel() {
      CellConstraints cc = new CellConstraints();
      PanelBuilder pb = new PanelBuilder(new FormLayout("5dlu,pref,3dlu,pref:grow,3dlu,pref,2dlu",
          "pref,5dlu,pref,3dlu,pref"),this);
      pb.setDefaultDialogBorder();

      pb.addSeparator(mLocalizer.msg("What", "What to start"), cc.xyw(1,1,7));
     
      JRadioButton application = new JRadioButton(mLocalizer.msg("Application", "Application"));
       
      pb.add(application, cc.xy(2,3));
       
      mPathTextField.setText(mData.getProgramPath());
      mPathTextField.addFocusListener(new FocusAdapter() {
        public void focusLost(FocusEvent e) {
          mData.setProgramPath(mPathTextField.getText());
        }
      });

      pb.add(mPathTextField, cc.xy(4,3));

      mFileButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          pathButtonPressed(e);
        }
      });

      pb.add(mFileButton, cc.xy(6,3));
       
      JRadioButton url = new JRadioButton(mLocalizer.msg("URL", "URL"));
       
      pb.add(url, cc.xy(2,5));
       
      mUrl.setText(mData.getWebUrl());
       
      mUrl.addFocusListener(new FocusAdapter() {
        public void focusLost(FocusEvent e) {
          mData.setWebUrl(mUrl.getText());
        }
      });

      pb.add(mUrl, cc.xyw(4,5,3));
       
      ButtonGroup group = new ButtonGroup();
       
      group.add(application);
      group.add(url);
View Full Code Here

  /**
   * creates a JPanel for managing the variables
   */
  private void createPanel() {
    CellConstraints cc = new CellConstraints();
    PanelBuilder pb = new PanelBuilder(new FormLayout("5dlu,pref:grow,5dlu","pref,5dlu,fill:default:grow"),this);
    pb.setDefaultDialogBorder();
   
    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer() {
      public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        JPanel background = new JPanel(new FormLayout("default:grow","fill:default:grow"));
        JLabel label = new JLabel(value.toString());
        label.setOpaque(false);
       
        if(isSelected) {
          background.setBackground(table.getSelectionBackground());
          label.setForeground(table.getSelectionForeground());
        }
        else {
          background.setBackground(table.getBackground());
        }
       
        background.add(label, new CellConstraints().xy(1,1));
       
        return background;
      }
    };
   
    VariableTableModel variableTableModel = new VariableTableModel(mData);
    mVariableTable.setModel(variableTableModel);
    mVariableTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    mVariableTable.getTableHeader().setReorderingAllowed(false);
    mVariableTable.getColumnModel().getColumn(0).setPreferredWidth(40);
    mVariableTable.getColumnModel().getColumn(0).setCellRenderer(renderer);
    mVariableTable.getColumnModel().getColumn(1).setCellRenderer(renderer);
    mVariableTable.getColumnModel().getColumn(2).setCellRenderer(renderer);
   
    JScrollPane sp = new JScrollPane(mVariableTable);

    addAncestorListener(new AncestorListener() {
      public void ancestorAdded(AncestorEvent event) {}
     
      public void ancestorMoved(AncestorEvent event) {}

      public void ancestorRemoved(AncestorEvent event) {
        if (mVariableTable.isEditing()) {
          TableCellEditor editor = mVariableTable.getCellEditor();
          if (editor != null) {
            editor.stopCellEditing();
          }
        }
      }
    });
   
    pb.addSeparator(mLocalizer.msg("Variables", "Variables"), cc.xyw(1,1,3));
    pb.add(sp, cc.xy(2,3));
  }
View Full Code Here

  private JLabel mInfoFontLabel;

  private JLabel mTitleFontLabel;

  public JPanel createSettingsPanel() {
    PanelBuilder mainPanel = new PanelBuilder(new FormLayout("5dlu, 10dlu, pref, 3dlu, pref, fill:3dlu:grow",
        "pref, 5dlu, pref, 10dlu, pref, 5dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref"));
    mainPanel.setBorder(Borders.DIALOG_BORDER);
   
    CellConstraints cc = new CellConstraints();
   
    mainPanel.addSeparator(mLocalizer.msg("Fonts", "Fonts"), cc.xyw(1,1,6));
   
    mEnableAntialiasingCB = new JCheckBox(mLocalizer.msg("EnableAntialiasing", "Enable antialiasing"));
    mEnableAntialiasingCB.setSelected(Settings.propEnableAntialiasing.getBoolean());

    mainPanel.add(mEnableAntialiasingCB, cc.xyw(2,3, 4));

    mainPanel.addSeparator(mLocalizer.msg("UserDefinedFonts", "Userdefined Fonts"), cc.xyw(1,5,6));

    mUseDefaultFontsCB = new JCheckBox(mLocalizer.msg("UseDefaultFonts", "Use default fonts"));
    mUseDefaultFontsCB.setSelected(Settings.propUseDefaultFonts.getBoolean());
   
    mainPanel.add(mUseDefaultFontsCB, cc.xyw(2,7, 4));
       
    mTitleFontLabel = new JLabel(mLocalizer.msg("ProgramTitle", "Program title"));
    mainPanel.add(mTitleFontLabel, cc.xy(3,9));
    mTitleFontPanel = new FontChooserPanel(Settings.propProgramTitleFont.getFont());
    mainPanel.add(mTitleFontPanel, cc.xy(5,9));

    mInfoFontLabel = new JLabel(mLocalizer.msg("ProgramInfo", "Program information"));
    mainPanel.add(mInfoFontLabel, cc.xy(3,11));
    mInfoFontPanel = new FontChooserPanel(Settings.propProgramInfoFont.getFont());
    mainPanel.add(mInfoFontPanel, cc.xy(5,11));

    mChannelNameFontLabel = new JLabel(mLocalizer.msg("ChannelNames", "Channel name"));
    mainPanel.add(mChannelNameFontLabel, cc.xy(3,13));
    mChannelNameFontPanel = new FontChooserPanel(Settings.propChannelNameFont.getFont());
    mainPanel.add(mChannelNameFontPanel, cc.xy(5,13));

    mTimeFontLabel = new JLabel(mLocalizer.msg("Time", "Time"));
    mainPanel.add(mTimeFontLabel, cc.xy(3,15));
    mTimeFontPanel = new FontChooserPanel(Settings.propProgramTimeFont.getFont());
    mainPanel.add(mTimeFontPanel, cc.xy(5,15));

    mUseDefaultFontsCB.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        enableFontFields(!mUseDefaultFontsCB.isSelected());
      }
    });
   
    enableFontFields(!mUseDefaultFontsCB.isSelected());
    return mainPanel.getPanel();
  }
View Full Code Here

TOP

Related Classes of com.jgoodies.forms.builder.PanelBuilder

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.