private void createDialog() {
JPanel panel = (JPanel) getContentPane();
UiUtilities.registerForClosing(this);
panel.setLayout(new FormLayout("default, 3dlu, fill:default:grow",
"default, 3dlu, default, 3dlu, default, 3dlu, default, 3dlu, default, 3dlu, default, 3dlu, default, 5dlu, default, 3dlu, default, 3dlu:grow, default, 5dlu, default"));
CellConstraints cc = new CellConstraints();
panel.setBorder(Borders.DLU4_BORDER);
// name
panel.add(new JLabel(mLocalizer.msg("channelName", "Channel Name:")), cc.xy(1, 1));
mChannelName = new JTextField(mChannel.getName());
panel.add(mChannelName, cc.xy(3, 1));
// provider
panel.add(new JLabel(mLocalizer.msg("provider", "Provided by:")), cc.xy(1, 3));
panel.add(new JLabel(ChannelUtil.getProviderName(mChannel)), cc.xy(3, 3));
// logo
panel.add(new JLabel(mLocalizer.msg("channelLogo", "Channel Logo:")), cc.xy(1, 5));
if (mChannel.getUserIconFileName() != null) {
mIconFile = new File(mChannel.getUserIconFileName());
}
mIconLabel = new JLabel(createUserIcon());
mChangeIcon = new JButton(mLocalizer.msg("useIcon", "Select channel icon"));
mChangeIcon.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
changeIcon();
}
});
panel.add(mIconLabel, cc.xy(3, 5));
panel.add(mChangeIcon, cc.xy(3, 7));
// URL
panel.add(new JLabel(mLocalizer.msg("webAddress", "Web Address:")), cc.xy(1, 9));
mWebPage =new JTextField(mChannel.getWebpage());
panel.add(mWebPage, cc.xy(3, 9));
// time correction
panel.add(new JLabel(mLocalizer.msg("time", "Time zone correction:")), cc.xy(1, 11));
mCorrectionCB = new JComboBox(new String[] { "-1:00", "-0:45", "-0:30", "-0:15", "0:00", "+0:15", "+0:30", "+0:45", "+1:00" });
mCorrectionCB.setSelectedIndex(mChannel.getTimeZoneCorrectionMinutes() / 15 + 4);
panel.add(mCorrectionCB, cc.xy(3, 11));
JTextArea txt = UiUtilities.createHelpTextArea(mLocalizer.msg("DLSTNote", ""));
// Hack because of growing JTextArea in FormLayout
txt.setMinimumSize(new Dimension(150, 20));
panel.add(txt, cc.xy(3, 13));
// time limitation
panel.add(DefaultComponentFactory.getInstance().createLabel(mLocalizer.msg("timeLimits","Time limits:")), cc.xy(1,15));
String timePattern = mLocalizer.msg("timePattern", "hh:mm a");
mStartTimeLimit = new JSpinner(new SpinnerDateModel());
mStartTimeLimit.setEditor(new JSpinner.DateEditor(mStartTimeLimit, timePattern));
setTimeDate(mStartTimeLimit, mChannel.getStartTimeLimit());
mEndTimeLimit = new JSpinner(new SpinnerDateModel());
mEndTimeLimit.setEditor(new JSpinner.DateEditor(mEndTimeLimit, timePattern));
setTimeDate(mEndTimeLimit, mChannel.getEndTimeLimit());
((JSpinner.DateEditor)mStartTimeLimit.getEditor()).getTextField().setHorizontalAlignment(SwingConstants.LEFT);
((JSpinner.DateEditor)mEndTimeLimit.getEditor()).getTextField().setHorizontalAlignment(SwingConstants.LEFT);
CaretPositionCorrector.createCorrector(((JSpinner.DateEditor)mStartTimeLimit.getEditor()).getTextField(), new char[] {':'}, -1);
CaretPositionCorrector.createCorrector(((JSpinner.DateEditor)mEndTimeLimit.getEditor()).getTextField(), new char[] {':'}, -1);
PanelBuilder timeLimitPanel = new PanelBuilder(new FormLayout("default:grow,10dlu,default:grow","default,2dlu,default"));
timeLimitPanel.addLabel(mLocalizer.msg("startTime","Start time:"), cc.xy(1,1));
timeLimitPanel.addLabel(mLocalizer.msg("endTime","End time:"), cc.xy(3,1));
timeLimitPanel.add(mStartTimeLimit, cc.xy(1,3));
timeLimitPanel.add(mEndTimeLimit, cc.xy(3,3));