use of javax.swing.border.LineBorder in project AozoraEpub3 by hmdev.
the class AozoraEpub3Applet method init.
/** アプレット初期化 */
@Override
public void init() {
super.init();
this.setSize(new Dimension(520, 460));
//パス関連初期化
//this.jarPath = getClass().getClassLoader().getResource("").getFile();
//this.jarPath = this.jarPath.replaceFirst("\\/bin\\/$", "/");
//AppletではVelocityでパスがエラーになるのでとりあえず空文字に
this.jarPath = "";
this.cachePath = new File(this.jarPath + ".cache");
this.webConfigPath = new File(this.jarPath + "web");
this.profilePath = new File(this.jarPath + "profiles");
this.profilePath.mkdir();
//設定ファイル読み込み
props = new Properties();
try {
FileInputStream fos = new FileInputStream(this.jarPath + this.propFileName);
props.load(fos);
fos.close();
} catch (Exception e) {
}
String path = props.getProperty("LastDir");
if (path != null && path.length() > 0)
this.currentPath = new File(path);
JPanel tabPanel;
JPanel panel;
JPanel panelV;
JPanel panelH;
JLabel label;
Border padding0 = BorderFactory.createEmptyBorder(0, 0, 0, 0);
Border padding1 = BorderFactory.createEmptyBorder(1, 1, 1, 1);
Border padding2 = BorderFactory.createEmptyBorder(2, 2, 2, 2);
Border padding3 = BorderFactory.createEmptyBorder(3, 3, 3, 3);
Border padding5H3V = BorderFactory.createEmptyBorder(3, 5, 3, 5);
Border padding2H = BorderFactory.createEmptyBorder(0, 2, 0, 2);
Border padding4H = BorderFactory.createEmptyBorder(0, 4, 0, 4);
Border padding4H2V = BorderFactory.createEmptyBorder(2, 4, 2, 4);
Border padding3B = BorderFactory.createEmptyBorder(0, 0, 3, 0);
Border padding4B = BorderFactory.createEmptyBorder(0, 0, 4, 0);
Border iconPadding = BorderFactory.createEmptyBorder(0, 14, 0, 0);
Dimension panelSize = new Dimension(1920, 26);
Dimension panelSize28 = new Dimension(1920, 28);
Dimension panelVMaxSize = new Dimension(640, 22);
JTextField text = new JTextField();
Insets is = text.getInsets();
FontMetrics fm = this.getFontMetrics(text.getFont());
Dimension text3 = new Dimension(fm.stringWidth("000") + is.left + is.right + 2, 20);
Dimension text4 = new Dimension(fm.stringWidth("0000") + is.left + is.right + 2, 20);
Dimension text5 = new Dimension(fm.stringWidth("00000") + is.left + is.right + 2, 20);
Dimension text300 = new Dimension(300, 20);
Dimension combo3 = new Dimension(text3.width + 20, 20);
//アップレットのレイアウト設定
this.setLayout(new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS));
int dividerLocation = 230;
try {
dividerLocation = Integer.parseInt(props.getProperty("DividerLocation"));
} catch (Exception e) {
}
jSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
jSplitPane.setDividerLocation(dividerLocation);
jSplitPane.setDividerSize(3);
this.add(jSplitPane);
//Tab icons
ImageIcon epubIcon = new ImageIcon(AozoraEpub3Applet.class.getResource("images/epub.png"));
ImageIcon imageIcon = new ImageIcon(AozoraEpub3Applet.class.getResource("images/image.png"));
ImageIcon pageSettingIcon = new ImageIcon(AozoraEpub3Applet.class.getResource("images/page_setting.png"));
ImageIcon tocIcon = new ImageIcon(AozoraEpub3Applet.class.getResource("images/toc.png"));
ImageIcon styleIcon = new ImageIcon(AozoraEpub3Applet.class.getResource("images/style.png"));
ImageIcon webIcon = new ImageIcon(AozoraEpub3Applet.class.getResource("images/web.png"));
ImageIcon charIcon = new ImageIcon(AozoraEpub3Applet.class.getResource("images/char.png"));
ButtonGroup buttonGroup;
JPanel topPane = new JPanel();
topPane.setLayout(new BoxLayout(topPane, BoxLayout.Y_AXIS));
jSplitPane.add(topPane);
////////////////////////////////////////////////////////////////
//プリセットとプロファイル
////////////////////////////////////////////////////////////////
//プロファイルダイアログ
jProfileDialog = new JProfileDialog(iconImage, AozoraEpub3Applet.class.getResource("images/icon.png").toString().replaceFirst("/icon\\.png", "/"));
jProfileDialog.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
try {
switch(evt.getID()) {
case 1:
addProfile(evt.getSource().toString());
break;
case 2:
editProfile(evt.getSource().toString());
break;
case 3:
deleteProfile();
break;
}
} catch (Exception e) {
e.printStackTrace();
}
}
});
////////////////////////////////
panel = new JPanel();
topPanel = panel;
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setMinimumSize(panelSize28);
panel.setMaximumSize(panelSize28);
panel.setPreferredSize(panelSize28);
panel.setBorder(padding4H2V);
topPane.add(panel);
//プロファイル
label = new JLabel("プロファイル: ");
panel.add(label);
jComboProfile = new JComboBox();
jComboProfile.setEditable(false);
jComboProfile.setFocusable(false);
jComboProfile.setPreferredSize(new Dimension(320, 22));
jComboProfile.setBorder(padding0);
panel.add(jComboProfile);
panelV = new JPanel();
panelV.setLayout(new BoxLayout(panelV, BoxLayout.Y_AXIS));
panel.add(panelV);
//上
jButtonProfileUp = new JButton(new ImageIcon(AozoraEpub3Applet.class.getResource("images/spin_up.png")));
jButtonProfileUp.setToolTipText("選択中のプロファイルを選択リスト内で上に移動します");
jButtonProfileUp.setBorder(padding2);
jButtonProfileUp.setFocusPainted(false);
jButtonProfileUp.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
int idx = jComboProfile.getSelectedIndex();
if (idx > 0) {
Object item = jComboProfile.getItemAt(idx - 1);
jComboProfile.removeItemAt(idx - 1);
jComboProfile.insertItemAt(item, idx);
//移動ボタン有効化
setProfileMoveEnable();
}
}
});
panelV.add(jButtonProfileUp);
//下
jButtonProfileDown = new JButton(new ImageIcon(AozoraEpub3Applet.class.getResource("images/spin_down.png")));
jButtonProfileDown.setToolTipText("選択中のプロファイルを選択リスト内で下に移動します");
jButtonProfileDown.setBorder(padding2);
jButtonProfileDown.setFocusPainted(false);
jButtonProfileDown.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
int idx = jComboProfile.getSelectedIndex();
if (idx < jComboProfile.getItemCount() - 1) {
Object item = jComboProfile.getItemAt(idx + 1);
jComboProfile.removeItemAt(idx + 1);
jComboProfile.insertItemAt(item, idx);
//移動ボタン有効化
setProfileMoveEnable();
}
}
});
panelV.add(jButtonProfileDown);
//新規
jButtonProfileCreate = new JButton(new ImageIcon(AozoraEpub3Applet.class.getResource("images/add.png")));
jButtonProfileCreate.setToolTipText("現在の設定でプロファイルを新規作成します");
jButtonProfileCreate.setBorder(padding3);
jButtonProfileCreate.setFocusPainted(false);
jButtonProfileCreate.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
jProfileDialog.showCreate(jFrameParent.getLocation(), jComboProfile.getSelectedItem().toString() + "のコピー");
}
});
panel.add(jButtonProfileCreate);
//編集
jButtonProfileEdit = new JButton(new ImageIcon(AozoraEpub3Applet.class.getResource("images/edit.png")));
jButtonProfileEdit.setToolTipText("選択中のプロファイルを名称変更・削除します");
jButtonProfileEdit.setBorder(padding3);
jButtonProfileEdit.setFocusPainted(false);
jButtonProfileEdit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
jProfileDialog.showEdit(jFrameParent.getLocation(), jComboProfile.getSelectedItem().toString(), jComboProfile.getItemCount() > 1);
}
});
panel.add(jButtonProfileEdit);
//端末プリセット
label = new JLabel(" ");
panel.add(label);
jPopupPreset = new JPopupMenu();
//presetsファイルから名称を取得してPopupに追加
for (File presetFile : new File(jarPath + "presets").listFiles()) {
Properties presetProps = new Properties();
try {
FileInputStream fos = new FileInputStream(presetFile);
presetProps.load(fos);
fos.close();
} catch (Exception e) {
}
String name = presetProps.getProperty("PresetName");
if (name != null && name.length() > 0) {
JMenuItem menu = new JMenuItem(name);
String iconName = presetProps.getProperty("PresetIcon");
if (iconName != null) {
try {
menu.setIcon(new ImageIcon(AozoraEpub3Applet.class.getResource("images/" + iconName)));
} catch (Exception r) {
}
}
menu.addActionListener(new LoadPresetActionListener(presetProps));
jPopupPreset.add(menu);
}
}
jButtonPreset = new JButton("端末設定", new ImageIcon(AozoraEpub3Applet.class.getResource("images/viewer.png")));
jButtonPreset.setToolTipText("端末に合わせた画面サイズと機種依存の最低限の設定を反映します");
jButtonPreset.setBorder(padding3);
jButtonPreset.setFocusPainted(false);
jButtonPreset.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
jPopupPreset.show(jButtonPreset, 8, 20);
}
});
panel.add(jButtonPreset);
jTabbedPane = new JTabbedPane();
jTabbedPane.setBorder(padding2H);
topPane.add(jTabbedPane);
////////////////////////////////////////////////////////////////
//Tab 変換
////////////////////////////////////////////////////////////////
tabPanel = new JPanel();
tabPanel.setLayout(new BoxLayout(tabPanel, BoxLayout.Y_AXIS));
jTabbedPane.setPreferredSize(new Dimension(1920, 220));
jTabbedPane.addTab("変換 ", epubIcon, tabPanel);
////////////////////////////////
//表題
////////////////////////////////
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setMinimumSize(panelSize);
panel.setMaximumSize(panelSize);
panel.setPreferredSize(panelSize);
panel.setBorder(padding4H2V);
tabPanel.add(panel);
label = new JLabel("表題: ");
panel.add(label);
label = new JLabel("本文内");
label.setBorder(padding2H);
panel.add(label);
jComboTitle = new JComboBox(BookInfo.TitleType.titleTypeNames);
jComboTitle.setFocusable(false);
jComboTitle.setMaximumSize(new Dimension(200, 22));
jComboTitle.setBorder(padding0);
((JLabel) jComboTitle.getRenderer()).setBorder(padding2H);
panel.add(jComboTitle);
//入力ファイル名優先
jCheckPubFirst = new JCheckBox("先頭が発行者");
jCheckPubFirst.setFocusPainted(false);
panel.add(jCheckPubFirst);
//入力ファイル名優先
panel.add(new JLabel(" "));
jCheckUseFileName = new JCheckBox("ファイル名優先 ");
jCheckUseFileName.setFocusPainted(false);
panel.add(jCheckUseFileName);
////////////////////////////////
//表紙
////////////////////////////////
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setMinimumSize(panelSize);
panel.setMaximumSize(panelSize);
panel.setPreferredSize(panelSize);
panel.setBorder(padding4H2V);
tabPanel.add(panel);
//表紙
label = new JLabel("表紙: ");
panel.add(label);
jTextMaxCoverLine = new JTextField("10");
jTextMaxCoverLine.setToolTipText("先頭の挿絵に利用する画像注記を取得する最大行数 0なら制限なし");
jTextMaxCoverLine.setHorizontalAlignment(JTextField.RIGHT);
jTextMaxCoverLine.setMinimumSize(text4);
jTextMaxCoverLine.setMaximumSize(text4);
jTextMaxCoverLine.setPreferredSize(text4);
jTextMaxCoverLine.addFocusListener(new TextSelectFocusListener(jTextMaxCoverLine));
jTextMaxCoverLine.setInputVerifier(new IntegerInputVerifier(10, 0, 9999));
panel.add(jTextMaxCoverLine);
jLabelMaxCoverLine = new JLabel("行目までの");
jLabelMaxCoverLine.setToolTipText(jTextMaxCoverLine.getToolTipText());
jLabelMaxCoverLine.setBorder(padding2H);
panel.add(jLabelMaxCoverLine);
jComboCover = new JComboBox(new String[] { "[先頭の挿絵]", "[入力ファイル名と同じ画像(png,jpg)]", "[表紙無し]", "http://" });
jComboCover.setEditable(true);
jComboCover.setPreferredSize(new Dimension(320, 24));
jComboCover.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
boolean visible = jComboCover.getSelectedIndex() == 0;
jTextMaxCoverLine.setVisible(visible);
jLabelMaxCoverLine.setVisible(visible);
}
});
panel.add(jComboCover);
new DropTarget(jComboCover.getEditor().getEditorComponent(), DnDConstants.ACTION_COPY_OR_MOVE, new DropCoverListener(), true);
boolean visible = jComboCover.getSelectedIndex() == 0;
jTextMaxCoverLine.setVisible(visible);
jLabelMaxCoverLine.setVisible(visible);
jButtonCover = new JButton("選択");
jButtonCover.setBorder(padding3);
jButtonCover.setIcon(new ImageIcon(AozoraEpub3Applet.class.getResource("images/cover.png")));
jButtonCover.setFocusPainted(false);
jButtonCover.addActionListener(new CoverChooserListener(this));
panel.add(jButtonCover);
jCheckCoverHistory = new JCheckBox("表紙履歴利用", true);
jCheckCoverHistory.setToolTipText("前回の変換(またはスキップ)で設定した表紙を利用します ※履歴は再起動時に初期化されます");
jCheckCoverHistory.setFocusPainted(false);
panel.add(jCheckCoverHistory);
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setMinimumSize(panelSize);
panel.setMaximumSize(panelSize);
panel.setPreferredSize(panelSize);
panel.setBorder(padding4H2V);
tabPanel.add(panel);
//ページ出力
label = new JLabel("ページ出力:");
panel.add(label);
jCheckCoverPage = new JCheckBox("表紙画像 ", true);
jCheckCoverPage.setFocusPainted(false);
panel.add(jCheckCoverPage);
//左右中央
jCheckTitlePage = new JCheckBox("表題", true);
jCheckTitlePage.setToolTipText("表題を単独のページで出力します。チェック無し時は表題等は出力されません");
jCheckTitlePage.setFocusPainted(false);
panel.add(jCheckTitlePage);
label = new JLabel("(");
panel.add(label);
buttonGroup = new ButtonGroup();
jRadioTitleNormal = new JRadioButton("本文内 ");
jRadioTitleNormal.setToolTipText("別ページ処理せずに本文中に表題等を出力します。 目次は表題前に出力されます");
jRadioTitleNormal.setBorder(padding0);
jRadioTitleNormal.setIconTextGap(1);
panel.add(jRadioTitleNormal);
buttonGroup.add(jRadioTitleNormal);
jRadioTitleMiddle = new JRadioButton("中央 ", true);
jRadioTitleMiddle.setToolTipText("中央寄せの表題ページを出力します");
jRadioTitleMiddle.setBorder(padding0);
jRadioTitleMiddle.setIconTextGap(1);
panel.add(jRadioTitleMiddle);
buttonGroup.add(jRadioTitleMiddle);
jRadioTitleHorizontal = new JRadioButton("横書き");
jRadioTitleHorizontal.setToolTipText("横書きの表題ページを出力します");
jRadioTitleHorizontal.setBorder(padding0);
jRadioTitleHorizontal.setIconTextGap(1);
panel.add(jRadioTitleHorizontal);
buttonGroup.add(jRadioTitleHorizontal);
label = new JLabel(") ");
panel.add(label);
jCheckTocPage = new JCheckBox("目次");
jCheckTocPage.setToolTipText("目次ページを表題ページの次に追加します");
jCheckTocPage.setFocusPainted(false);
panel.add(jCheckTocPage);
label = new JLabel("(");
panel.add(label);
buttonGroup = new ButtonGroup();
jRadioTocV = new JRadioButton("縦 ", true);
jRadioTocV.setFocusPainted(false);
jRadioTocV.setIconTextGap(2);
jRadioTocV.setBorder(padding0);
panel.add(jRadioTocV);
buttonGroup.add(jRadioTocV);
jRadioTocH = new JRadioButton("横");
jRadioTocH.setFocusPainted(false);
jRadioTocH.setIconTextGap(2);
jRadioTocH.setBorder(padding0);
panel.add(jRadioTocH);
buttonGroup.add(jRadioTocH);
label = new JLabel(")");
panel.add(label);
////////////////////////////////
//出力ファイル設定
////////////////////////////////
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setMinimumSize(panelSize);
panel.setMaximumSize(panelSize);
panel.setPreferredSize(panelSize);
panel.setBorder(padding4H2V);
tabPanel.add(panel);
//拡張子
label = new JLabel("拡張子: ");
panel.add(label);
jComboExt = new JComboBox(new String[] { ".epub", ".kepub.epub", ".fxl.kepub.epub", ".mobi", ".mobi+.epub" });
jComboExt.setToolTipText("出力するファイルの拡張子を選択します。 mobi出力時はKindlegenが必要になります");
jComboExt.setEditable(true);
jComboExt.setMaximumSize(new Dimension(110, 24));
jComboExt.setPreferredSize(new Dimension(110, 24));
panel.add(jComboExt);
label = new JLabel(" ");
panel.add(label);
//出力ファイル名設定
jCheckAutoFileName = new JCheckBox("出力ファイル名に表題利用", true);
jCheckAutoFileName.setFocusPainted(false);
panel.add(jCheckAutoFileName);
label = new JLabel(" ");
panel.add(label);
//ファイルの上書き許可
jCheckOverWrite = new JCheckBox("出力ファイル上書き", true);
jCheckOverWrite.setFocusPainted(false);
panel.add(jCheckOverWrite);
////////////////////////////////
//出力先 履歴をpropsから読み込んで設定
////////////////////////////////
dstPathChooser = new DstPathChooserListener(this);
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setMinimumSize(panelSize);
panel.setMaximumSize(panelSize);
panel.setPreferredSize(panelSize);
panel.setBorder(padding4H2V);
tabPanel.add(panel);
//出力先
label = new JLabel("出力先: ");
panel.add(label);
jCheckSamePath = new JCheckBox("入力と同じ", true);
jCheckSamePath.setToolTipText("入力ファイルと同じ場所に出力します");
panel.add(jCheckSamePath);
jCheckSamePath.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
jComboDstPath.setEditable(!jCheckSamePath.isSelected());
jComboDstPath.setForeground(jCheckSamePath.isSelected() ? Color.gray : Color.black);
jComboDstPath.repaint();
}
});
jComboDstPath = new JComboBox();
jComboDstPath.setToolTipText("出力先を指定します。変換時に履歴に追加されます。フォルダのドロップでも設定できます");
jComboDstPath.setEditable(false);
jComboDstPath.setForeground(Color.gray);
jComboDstPath.setPreferredSize(new Dimension(260, 24));
//パスを追加
//vecDstPath.add("[入力ファイルと同じ場所]");
String propValue = props.getProperty("DstPathList");
String dstPath = props.getProperty("DstPath");
if (propValue != null && propValue.length() > 0) {
for (String listPath : propValue.split(",")) {
if (!"".equals(listPath))
jComboDstPath.addItem(listPath);
}
}
if (dstPath != null && !dstPath.equals("")) {
jComboDstPath.setSelectedItem(dstPath);
}
panel.add(jComboDstPath);
new DropTarget(jComboDstPath.getEditor().getEditorComponent(), DnDConstants.ACTION_COPY_OR_MOVE, new DropDstPathListener(), true);
//選択解除
if ("".equals(props.getProperty("SamePath")))
jCheckSamePath.setSelected(false);
jButtonDstPath = new JButton("選択");
jButtonDstPath.setBorder(padding3);
jButtonDstPath.setIcon(new ImageIcon(AozoraEpub3Applet.class.getResource("images/dst_path.png")));
jButtonDstPath.setFocusPainted(false);
jButtonDstPath.addActionListener(dstPathChooser);
panel.add(jButtonDstPath);
////////////////////////////////
/*group = new ButtonGroup();
jRadioRtL = new JRadioButton("右→左");
jRadioRtL.setFocusPainted(false);
panel.add(jRadioRtL);
group.add(jRadioRtL);
jRadioLtR = new JRadioButton("左→右");
jRadioLtR.setFocusPainted(false);
panel.add(jRadioLtR);
group.add(jRadioLtR);*/
////////////////////////////////
//変換
////////////////////////////////
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setMaximumSize(new Dimension(1920, 32));
panel.setPreferredSize(new Dimension(1920, 32));
panel.setBorder(padding4H);
tabPanel.add(panel);
//左パネル
JPanel panel1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
//panel1.setPreferredSize(panelSize);
panel1.setBorder(padding0);
//入力文字コード
label = new JLabel("入力文字コード");
label.setBorder(padding0);
panel1.add(label);
jComboEncType = new JComboBox(new String[] { "MS932", "UTF-8" });
jComboEncType.setToolTipText("入力ファイルのテキストファイルの文字コード。青空文庫の標準はMS932(SJIS)です");
jComboEncType.setFocusable(false);
jComboEncType.setPreferredSize(new Dimension(100, 22));
panel1.add(jComboEncType);
panel.add(panel1);
//右パネル
JPanel panel2 = new JPanel(new FlowLayout(FlowLayout.RIGHT));
//panel2.setPreferredSize(panelSize);
panel.setBorder(padding0);
//縦書き横書き
buttonGroup = new ButtonGroup();
jRadioVertical = new JRadioButton();
jRadioVertical.setSelected(true);
jRadioVertical.setFocusPainted(false);
//jRadioVertical.setBorder(BorderFactory.createEmptyBorder(0, 100, 0, 0));
jRadioVertical.setBorder(padding0);
jRadioVertical.setIconTextGap(0);
label = new JLabel("縦書き", new ImageIcon(AozoraEpub3Applet.class.getResource("images/page_vertical.png")), JLabel.LEFT);
label.setBorder(iconPadding);
jRadioVertical.add(label);
panel2.add(jRadioVertical);
buttonGroup.add(jRadioVertical);
jRadioHorizontal = new JRadioButton();
jRadioHorizontal.setFocusPainted(false);
jRadioHorizontal.setBorder(padding0);
jRadioHorizontal.setIconTextGap(0);
label = new JLabel("横書き ", new ImageIcon(AozoraEpub3Applet.class.getResource("images/page_horizontal.png")), JLabel.LEFT);
label.setBorder(iconPadding);
jRadioHorizontal.add(label);
panel2.add(jRadioHorizontal);
buttonGroup.add(jRadioHorizontal);
//ファイル選択
jButtonFile = new JButton("ファイル選択");
jButtonFile.setToolTipText("ファイル選択後に変換処理を開始します");
jButtonFile.setBorder(padding5H3V);
//jButtonFile.setPreferredSize(new Dimension(100, 24));
jButtonFile.setIcon(new ImageIcon(AozoraEpub3Applet.class.getResource("images/convert.png")));
jButtonFile.setFocusPainted(false);
jButtonFile.addActionListener(new FileChooserListener(this));
panel2.add(jButtonFile);
panel.add(panel2);
////////////////////////////////////////////////////////////////
//Tab 画像配置
////////////////////////////////////////////////////////////////
tabPanel = new JPanel();
//tabPanel.setLayout(new BoxLayout(tabPanel, BoxLayout.Y_AXIS));
tabPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 0));
jTabbedPane.addTab("画像1", imageIcon, tabPanel);
////////////////////////////////
//挿絵なし
////////////////////////////////
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("画像注記"));
tabPanel.add(panel);
jCheckNoIllust = new JCheckBox("挿絵除外 ");
jCheckNoIllust.setFocusPainted(false);
jCheckNoIllust.setToolTipText("テキストの画像注記は表紙と外字画像以外はePubに格納されません");
jCheckNoIllust.setBorder(padding2);
panel.add(jCheckNoIllust);
////////////////////////////////
//画面サイズ
////////////////////////////////
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("画面・表紙サイズ"));
tabPanel.add(panel);
//画面サイズ
label = new JLabel(" 画面: 横");
panel.add(label);
jTextDispW = new JTextField("600");
jTextDispW.setHorizontalAlignment(JTextField.RIGHT);
jTextDispW.setMaximumSize(text4);
jTextDispW.setPreferredSize(text4);
jTextDispW.addFocusListener(new TextSelectFocusListener(jTextDispW));
jTextDispW.setInputVerifier(new IntegerInputVerifier(600, 1, 9999));
panel.add(jTextDispW);
label = new JLabel("x");
label.setBorder(padding2H);
panel.add(label);
label = new JLabel("縦");
panel.add(label);
jTextDispH = new JTextField("800");
jTextDispH.setHorizontalAlignment(JTextField.RIGHT);
jTextDispH.setMaximumSize(text4);
jTextDispH.setPreferredSize(text4);
jTextDispH.addFocusListener(new TextSelectFocusListener(jTextDispH));
jTextDispH.setInputVerifier(new IntegerInputVerifier(800, 1, 9999));
panel.add(jTextDispH);
label = new JLabel("px");
label.setBorder(padding2H);
panel.add(label);
////////////////////////////////
//表紙サイズ
//横x縦
label = new JLabel(" 表紙: 横");
panel.add(label);
jTextCoverW = new JTextField("600");
jTextCoverW.setHorizontalAlignment(JTextField.RIGHT);
jTextCoverW.setInputVerifier(new IntegerInputVerifier(600, 64, 4096));
jTextCoverW.setMaximumSize(text4);
jTextCoverW.setPreferredSize(text4);
jTextCoverW.addFocusListener(new TextSelectFocusListener(jTextCoverW));
panel.add(jTextCoverW);
label = new JLabel("x");
label.setBorder(padding2H);
panel.add(label);
label = new JLabel("縦");
panel.add(label);
jTextCoverH = new JTextField("800");
jTextCoverH.setHorizontalAlignment(JTextField.RIGHT);
jTextCoverH.setInputVerifier(new IntegerInputVerifier(800, 64, 4096));
jTextCoverH.setMaximumSize(text4);
jTextCoverH.setPreferredSize(text4);
jTextCoverH.addFocusListener(new TextSelectFocusListener(jTextCoverH));
panel.add(jTextCoverH);
label = new JLabel("px");
label.setBorder(padding2H);
panel.add(label);
////////////////////////////////
//画像倍率
////////////////////////////////
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("画像表示倍率"));
tabPanel.add(panel);
jCheckImageScale = new JCheckBox("有効 ", true);
jCheckImageScale.setToolTipText("画面の解像度に合わせて画像の幅を%指定します。画像キャプションがはみ出る場合も指定してください");
jCheckImageScale.setFocusPainted(false);
jCheckImageScale.setBorder(padding2);
jCheckImageScale.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
jTextImageScale.setEditable(jCheckImageScale.isSelected());
}
});
panel.add(jCheckImageScale);
jTextImageScale = new JTextField("1.0");
jTextImageScale.setToolTipText("指定倍率で画像を拡大表示します。64px以下の画像は変更されません");
jTextImageScale.setHorizontalAlignment(JTextField.RIGHT);
jTextImageScale.setInputVerifier(new FloatInputVerifier(1, 0.01f, 30));
jTextImageScale.setMaximumSize(text4);
jTextImageScale.setPreferredSize(text4);
jTextImageScale.addFocusListener(new TextSelectFocusListener(jTextImageScale));
panel.add(jTextImageScale);
label = new JLabel("倍");
panel.add(label);
////////////////////////////////
//画像回り込み
////////////////////////////////
//画像回り込み
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("画像回り込み (※単ページ化より優先)"));
tabPanel.add(panel);
jCheckImageFloat = new JCheckBox("回り込み有効 ");
jCheckImageFloat.setToolTipText("画像の実サイズが指定サイズ以下の画像を回り込み設定します");
jCheckImageFloat.setFocusPainted(false);
jCheckImageFloat.setBorder(padding2);
jCheckImageFloat.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
jTextImageFloatW.setEditable(jCheckImageFloat.isSelected());
jTextImageFloatH.setEditable(jCheckImageFloat.isSelected());
}
});
panel.add(jCheckImageFloat);
label = new JLabel("横");
panel.add(label);
jTextImageFloatW = new JTextField("600");
jTextImageFloatW.setHorizontalAlignment(JTextField.RIGHT);
jTextImageFloatW.setInputVerifier(new IntegerInputVerifier(600, 1, 9999));
jTextImageFloatW.setMaximumSize(text4);
jTextImageFloatW.setPreferredSize(text4);
jTextImageFloatW.addFocusListener(new TextSelectFocusListener(jTextImageFloatW));
jTextImageFloatW.setEditable(jCheckImageFloat.isSelected());
panel.add(jTextImageFloatW);
label = new JLabel("x");
label.setBorder(padding2H);
panel.add(label);
label = new JLabel("縦");
panel.add(label);
jTextImageFloatH = new JTextField("400");
jTextImageFloatH.setHorizontalAlignment(JTextField.RIGHT);
jTextImageFloatH.setInputVerifier(new IntegerInputVerifier(400, 1, 9999));
jTextImageFloatH.setMaximumSize(text4);
jTextImageFloatH.setPreferredSize(text4);
jTextImageFloatH.addFocusListener(new TextSelectFocusListener(jTextImageFloatH));
jTextImageFloatH.setEditable(jCheckImageFloat.isSelected());
panel.add(jTextImageFloatH);
label = new JLabel("px以下");
label.setBorder(padding2H);
panel.add(label);
label = new JLabel(" 配置");
panel.add(label);
jComboImageFloatType = new JComboBox(new String[] { "上/左", "下/右" });
jComboImageFloatType.setFocusable(false);
jComboImageFloatType.setBorder(padding0);
jComboImageFloatType.setPreferredSize(new Dimension(text4.width + 24, 20));
panel.add(jComboImageFloatType);
////////////////////////////////
//画像単ページ化
////////////////////////////////
panelV = new JPanel();
panelV.setLayout(new BoxLayout(panelV, BoxLayout.Y_AXIS));
panelV.setBorder(new NarrowTitledBorder("画像単ページ化"));
tabPanel.add(panelV);
//上段
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setMaximumSize(panelVMaxSize);
panel.setBorder(padding4B);
panelV.add(panel);
//横x縦
label = new JLabel("横");
panel.add(label);
jTextSinglePageSizeW = new JTextField("400");
jTextSinglePageSizeW.setHorizontalAlignment(JTextField.RIGHT);
jTextSinglePageSizeW.setInputVerifier(new IntegerInputVerifier(400, 1, 9999));
jTextSinglePageSizeW.setMaximumSize(text4);
jTextSinglePageSizeW.setPreferredSize(text4);
jTextSinglePageSizeW.addFocusListener(new TextSelectFocusListener(jTextSinglePageSizeW));
panel.add(jTextSinglePageSizeW);
label = new JLabel("x");
label.setBorder(padding2H);
panel.add(label);
label = new JLabel("縦");
panel.add(label);
jTextSinglePageSizeH = new JTextField("600");
jTextSinglePageSizeH.setHorizontalAlignment(JTextField.RIGHT);
jTextSinglePageSizeH.setInputVerifier(new IntegerInputVerifier(600, 1, 9999));
jTextSinglePageSizeH.setMaximumSize(text4);
jTextSinglePageSizeH.setPreferredSize(text4);
jTextSinglePageSizeH.addFocusListener(new TextSelectFocusListener(jTextSinglePageSizeH));
panel.add(jTextSinglePageSizeH);
label = new JLabel("px以上 ");
label.setBorder(padding2H);
panel.add(label);
//横のみ
label = new JLabel("横のみ");
label.setBorder(padding2H);
panel.add(label);
jTextSinglePageWidth = new JTextField("600");
jTextSinglePageWidth.setHorizontalAlignment(JTextField.RIGHT);
jTextSinglePageWidth.setInputVerifier(new IntegerInputVerifier(600, 1, 9999));
jTextSinglePageWidth.setMaximumSize(text4);
jTextSinglePageWidth.setPreferredSize(text4);
jTextSinglePageWidth.addFocusListener(new TextSelectFocusListener(jTextSinglePageWidth));
panel.add(jTextSinglePageWidth);
label = new JLabel("px以上");
label.setBorder(padding2H);
panel.add(label);
//下段
panel = new JPanel();
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
panelV.add(panel);
label = new JLabel("縮小表示 (");
label.setBorder(padding2H);
panel.add(label);
buttonGroup = new ButtonGroup();
jRadioImageSizeType1 = new JRadioButton("指定無し");
jRadioImageSizeType1.setToolTipText("画像のサイズを指定しません。 端末が自動で縮小します(Kindle, Kobo)");
jRadioImageSizeType1.setFocusPainted(false);
jRadioImageSizeType1.setBorder(padding2);
jRadioImageSizeType1.setIconTextGap(1);
panel.add(jRadioImageSizeType1);
buttonGroup.add(jRadioImageSizeType1);
/*jRadioImageSizeType2 = new JRadioButton("高さ%", true);
jRadioImageSizeType2.setToolTipText("画面の縦横比に合せて画像の高さのみ%指定します。画面設定より縦長の端末でははみ出すか縦長に表示されます");
jRadioImageSizeType2.setFocusPainted(false);
jRadioImageSizeType2.setBorder(padding2);
jRadioImageSizeType2.setIconTextGap(1);
panel.add(jRadioImageSizeType2);
buttonGroup.add(jRadioImageSizeType2);*/
jRadioImageSizeType3 = new JRadioButton("縦横比");
jRadioImageSizeType3.setToolTipText("画面の縦横比に合せて幅または高さを100%指定します。画面回転で画像がはみ出す場合があります");
jRadioImageSizeType3.setFocusPainted(false);
jRadioImageSizeType3.setBorder(padding2);
jRadioImageSizeType3.setIconTextGap(1);
panel.add(jRadioImageSizeType3);
buttonGroup.add(jRadioImageSizeType3);
label = new JLabel(") ");
label.setBorder(padding2H);
panel.add(label);
jCheckFitImage = new JCheckBox("拡大表示", true);
jCheckFitImage.setToolTipText("画面サイズより小さい画像を幅高さに合わせて拡大表示します。画面回転で画像がはみ出す場合があります");
jCheckFitImage.setFocusPainted(false);
jCheckFitImage.setBorder(padding2);
panel.add(jCheckFitImage);
buttonGroup = new ButtonGroup();
//Float表示
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("Float指定 (Readerのみ)"));
tabPanel.add(panel);
jCheckImageFloatPage = new JCheckBox("単ページ画像");
jCheckImageFloatPage.setToolTipText("単ページ対象の画像をfloat表示します。 xhtmlは分割されません");
jCheckImageFloatPage.setFocusPainted(false);
jCheckImageFloatPage.setBorder(padding2);
panel.add(jCheckImageFloatPage);
jCheckImageFloatBlock = new JCheckBox("通常画像");
jCheckImageFloatBlock.setToolTipText("回り込み、単ページ以外の画像をfloat表示します。 64px以上の画像のみ");
jCheckImageFloatBlock.setFocusPainted(false);
jCheckImageFloatBlock.setBorder(padding2);
panel.add(jCheckImageFloatBlock);
////////////////////////////////////////////////////////////////
//Tab 画像2
////////////////////////////////////////////////////////////////
tabPanel = new JPanel();
//tabPanel.setLayout(new BoxLayout(tabPanel, BoxLayout.Y_AXIS));
tabPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 0));
jTabbedPane.addTab("画像2", imageIcon, tabPanel);
////////////////////////////////
//全画面+SVG
////////////////////////////////
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("全画面表示"));
tabPanel.add(panel);
jCheckSvgImage = new JCheckBox("SVGタグ出力(画像zipのみ) ");
jCheckSvgImage.setFocusPainted(false);
jCheckSvgImage.setToolTipText("画像のみのzipの場合、固定レイアウト+SVGタグで出力します");
jCheckSvgImage.setBorder(padding2);
panel.add(jCheckSvgImage);
////////////////////////////////
//画像調整
////////////////////////////////
//Jpeg圧縮率
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("Jpeg圧縮率"));
tabPanel.add(panel);
jTextJpegQuality = new JTextField("85");
jTextJpegQuality.setToolTipText("表紙編集、縮小、回転、余白除去時のJpeg保存時の画質(100が最高画質)");
jTextJpegQuality.setHorizontalAlignment(JTextField.RIGHT);
jTextJpegQuality.setInputVerifier(new IntegerInputVerifier(85, 30, 100));
jTextJpegQuality.setMaximumSize(text3);
jTextJpegQuality.setPreferredSize(text3);
jTextJpegQuality.addFocusListener(new TextSelectFocusListener(jTextJpegQuality));
panel.add(jTextJpegQuality);
panel.add(new JLabel(" (30~100)"));
////////////////////////////////
//ガンマ補正
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("色調整"));
tabPanel.add(panel);
jCheckGamma = new JCheckBox("ガンマ補正");
jCheckGamma.setToolTipText("画像の濃さを変更します (濃:0.2~1.8:淡)");
jCheckGamma.setFocusPainted(false);
jCheckGamma.setBorder(padding2);
jCheckGamma.setIconTextGap(2);
jCheckGamma.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
jTextGammaValue.setEditable(jCheckGamma.isSelected());
}
});
panel.add(jCheckGamma);
jTextGammaValue = new JTextField("1.0");
jTextGammaValue.setToolTipText(jCheckGamma.getToolTipText());
jTextGammaValue.setHorizontalAlignment(JTextField.RIGHT);
jTextGammaValue.setInputVerifier(new FloatInputVerifier(1.0f, 0.2f, 1.8f));
jTextGammaValue.setMaximumSize(text3);
jTextGammaValue.setPreferredSize(text3);
jTextGammaValue.setEditable(jCheckGamma.isSelected());
jTextGammaValue.addFocusListener(new TextSelectFocusListener(jTextGammaValue));
panel.add(jTextGammaValue);
////////////////////////////////
//画像縮小
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("画像縮小回転"));
tabPanel.add(panel);
ChangeListener resizeChangeLister = new ChangeListener() {
public void stateChanged(ChangeEvent e) {
setResizeTextEditable(true);
}
};
//横
jCheckResizeW = new JCheckBox("横");
jCheckResizeW.setFocusPainted(false);
jCheckResizeW.setBorder(padding2);
jCheckResizeW.setIconTextGap(2);
jCheckResizeW.addChangeListener(resizeChangeLister);
panel.add(jCheckResizeW);
jTextResizeNumW = new JTextField("2048");
jTextResizeNumW.setHorizontalAlignment(JTextField.RIGHT);
jTextResizeNumW.setInputVerifier(new IntegerInputVerifier(2048, 100, 9999));
jTextResizeNumW.setMaximumSize(text4);
jTextResizeNumW.setPreferredSize(text4);
jTextResizeNumW.addFocusListener(new TextSelectFocusListener(jTextResizeNumW));
jTextResizeNumW.setEditable(jCheckResizeW.isSelected());
panel.add(jTextResizeNumW);
label = new JLabel("px以下 ");
label.setBorder(padding2H);
panel.add(label);
//縦
jCheckResizeH = new JCheckBox("縦");
jCheckResizeH.setFocusPainted(false);
jCheckResizeH.setBorder(padding2);
jCheckResizeH.setIconTextGap(2);
jCheckResizeH.addChangeListener(resizeChangeLister);
panel.add(jCheckResizeH);
jTextResizeNumH = new JTextField("2048");
jTextResizeNumH.setHorizontalAlignment(JTextField.RIGHT);
jTextResizeNumH.setInputVerifier(new IntegerInputVerifier(2048, 100, 9999));
jTextResizeNumH.setMaximumSize(text4);
jTextResizeNumH.setPreferredSize(text4);
jTextResizeNumH.addFocusListener(new TextSelectFocusListener(jTextResizeNumH));
panel.add(jTextResizeNumH);
label = new JLabel("px以下");
label.setBorder(padding2H);
panel.add(label);
this.setResizeTextEditable(true);
//自動画像回転
label = new JLabel(" 自動回転");
label.setBorder(padding2H);
panel.add(label);
jComboRotateImage = new JComboBox(new String[] { "なし", "右", "左" });
jComboRotateImage.setToolTipText("単ページ時画面の縦横比に合わせて画像を回転します");
jComboRotateImage.setFocusable(false);
jComboRotateImage.setBorder(padding0);
jComboRotateImage.setPreferredSize(new Dimension(text4.width + 24, 20));
panel.add(jComboRotateImage);
////////////////////////////////
//余白除去
////////////////////////////////
panelV = new JPanel();
panelV.setLayout(new BoxLayout(panelV, BoxLayout.Y_AXIS));
panelV.setBorder(new NarrowTitledBorder("余白除去"));
tabPanel.add(panelV);
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(padding4B);
panelV.add(panel);
jCheckAutoMargin = new JCheckBox("有効 ");
jCheckAutoMargin.setFocusPainted(false);
jCheckAutoMargin.setBorder(padding2);
jCheckAutoMargin.setIconTextGap(2);
jCheckAutoMargin.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
boolean selected = jCheckAutoMargin.isSelected();
jTextAutoMarginLimitH.setEditable(selected);
jTextAutoMarginLimitV.setEditable(selected);
jTextAutoMarginWhiteLevel.setEditable(selected);
jTextAutoMarginPadding.setEditable(selected);
jTextAutoMarginNombreSize.setEditable(selected);
}
});
panel.add(jCheckAutoMargin);
label = new JLabel(" 横");
label.setToolTipText("横方向の余白除去量の制限 左右の余白の合計");
panel.add(label);
jTextAutoMarginLimitH = new JTextField("15");
jTextAutoMarginLimitH.setToolTipText(label.getToolTipText());
jTextAutoMarginLimitH.setHorizontalAlignment(JTextField.RIGHT);
jTextAutoMarginLimitH.setInputVerifier(new IntegerInputVerifier(15, 0, 50));
jTextAutoMarginLimitH.setMaximumSize(text3);
jTextAutoMarginLimitH.setPreferredSize(text3);
jTextAutoMarginLimitH.setEditable(jCheckAutoMargin.isSelected());
jTextAutoMarginLimitH.addFocusListener(new TextSelectFocusListener(jTextAutoMarginLimitH));
panel.add(jTextAutoMarginLimitH);
label = new JLabel("%");
label.setBorder(padding2H);
panel.add(label);
label = new JLabel(" 縦");
label.setToolTipText("縦方向の余白除去量の制限 上下の余白の合計");
panel.add(label);
jTextAutoMarginLimitV = new JTextField("15");
jTextAutoMarginLimitV.setToolTipText(label.getToolTipText());
jTextAutoMarginLimitV.setHorizontalAlignment(JTextField.RIGHT);
jTextAutoMarginLimitV.setInputVerifier(new IntegerInputVerifier(15, 0, 50));
jTextAutoMarginLimitV.setMaximumSize(text3);
jTextAutoMarginLimitV.setPreferredSize(text3);
jTextAutoMarginLimitV.setEditable(jCheckAutoMargin.isSelected());
jTextAutoMarginLimitV.addFocusListener(new TextSelectFocusListener(jTextAutoMarginLimitV));
panel.add(jTextAutoMarginLimitV);
label = new JLabel("%");
label.setBorder(padding2H);
panel.add(label);
panel.add(label);
label = new JLabel(" 余白追加");
label.setToolTipText("余白除去後に追加する余白の量(追加部分の画像はそのまま)");
panel.add(label);
jTextAutoMarginPadding = new JTextField("1.0");
jTextAutoMarginPadding.setToolTipText(label.getToolTipText());
jTextAutoMarginPadding.setHorizontalAlignment(JTextField.RIGHT);
jTextAutoMarginPadding.setInputVerifier(new FloatInputVerifier(1.0f, 0, 50));
jTextAutoMarginPadding.setMaximumSize(text3);
jTextAutoMarginPadding.setPreferredSize(text3);
jTextAutoMarginPadding.setEditable(jCheckAutoMargin.isSelected());
jTextAutoMarginPadding.addFocusListener(new TextSelectFocusListener(jTextAutoMarginPadding));
panel.add(jTextAutoMarginPadding);
label = new JLabel("%");
label.setBorder(padding2H);
panel.add(label);
label = new JLabel(" 白レベル");
label.setToolTipText("余白部分の白い画素と判別するレベルを指定します (黒:0~白:100)");
panel.add(label);
jTextAutoMarginWhiteLevel = new JTextField("80");
jTextAutoMarginWhiteLevel.setToolTipText(label.getToolTipText());
jTextAutoMarginWhiteLevel.setHorizontalAlignment(JTextField.RIGHT);
jTextAutoMarginWhiteLevel.setInputVerifier(new IntegerInputVerifier(80, 0, 100));
jTextAutoMarginWhiteLevel.setMaximumSize(text3);
jTextAutoMarginWhiteLevel.setPreferredSize(text3);
jTextAutoMarginWhiteLevel.setEditable(jCheckAutoMargin.isSelected());
jTextAutoMarginWhiteLevel.addFocusListener(new TextSelectFocusListener(jTextAutoMarginWhiteLevel));
panel.add(jTextAutoMarginWhiteLevel);
label = new JLabel("%");
label.setBorder(padding2H);
panel = new JPanel();
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
panelV.add(panel);
label = new JLabel("ノンブル除去 (位置");
label.setBorder(padding2H);
panel.add(label);
jComboAutoMarginNombre = new JComboBox(new String[] { "なし", "上", "下", "上下" });
jComboAutoMarginNombre.setToolTipText("ノンブルを除去します。除去した場合は除去制限が5%追加されます");
jComboAutoMarginNombre.setFocusable(false);
jComboAutoMarginNombre.setMaximumSize(new Dimension(text3.width + 24, 20));
jComboAutoMarginNombre.setPreferredSize(new Dimension(text3.width + 24, 20));
panel.add(jComboAutoMarginNombre);
label = new JLabel(" 高さ");
label.setBorder(padding2H);
panel.add(label);
jTextAutoMarginNombreSize = new JTextField("3.0");
jTextAutoMarginNombreSize.setToolTipText("ノンブルの文字部分の高さを指定します。これより大きい場合はノンブル除去されません");
jTextAutoMarginNombreSize.setHorizontalAlignment(JTextField.RIGHT);
jTextAutoMarginNombreSize.setInputVerifier(new FloatInputVerifier(3.0f, 0.5f, 10));
jTextAutoMarginNombreSize.setMaximumSize(text3);
jTextAutoMarginNombreSize.setPreferredSize(text3);
jTextAutoMarginNombreSize.setEditable(jCheckAutoMargin.isSelected());
jTextAutoMarginNombreSize.addFocusListener(new TextSelectFocusListener(jTextAutoMarginPadding));
panel.add(jTextAutoMarginNombreSize);
label = new JLabel("% )");
label.setBorder(padding2H);
panel.add(label);
////////////////////////////////////////////////////////////////
//Tab 詳細設定
////////////////////////////////////////////////////////////////
tabPanel = new JPanel();
//tabPanel.setLayout(new BoxLayout(tabPanel, BoxLayout.Y_AXIS));
tabPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 0));
jTabbedPane.addTab("詳細設定", pageSettingIcon, tabPanel);
////////////////////////////////
//文中全角スペースの処理
////////////////////////////////
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("文中全角スペースの処理"));
tabPanel.add(panel);
//ピクセル
label = new JLabel("行末で非表示(");
label.setBorder(padding2);
panel.add(label);
buttonGroup = new ButtonGroup();
jRadioSpaceHyp1 = new JRadioButton("Kobo・Kindle ");
jRadioSpaceHyp1.setToolTipText("Kobo・Kindleで行末で非表示にします Readerではそのままと同じ表示になります");
jRadioSpaceHyp1.setFocusPainted(false);
jRadioSpaceHyp1.setIconTextGap(2);
jRadioSpaceHyp1.setBorder(padding2);
panel.add(jRadioSpaceHyp1);
buttonGroup.add(jRadioSpaceHyp1);
jRadioSpaceHyp2 = new JRadioButton("Reader ) ");
jRadioSpaceHyp2.setToolTipText("Reader以外では次行に追い出しの禁則処理になります");
jRadioSpaceHyp2.setFocusPainted(false);
jRadioSpaceHyp2.setIconTextGap(2);
jRadioSpaceHyp2.setBorder(padding2);
panel.add(jRadioSpaceHyp2);
buttonGroup.add(jRadioSpaceHyp2);
jRadioSpaceHyp0 = new JRadioButton("そのまま", true);
jRadioSpaceHyp0.setToolTipText("行の折り返し部分にある全角スペースが行頭に表示されます");
jRadioSpaceHyp0.setFocusPainted(false);
jRadioSpaceHyp0.setIconTextGap(2);
jRadioSpaceHyp0.setBorder(padding2);
panel.add(jRadioSpaceHyp0);
buttonGroup.add(jRadioSpaceHyp0);
////////////////////////////////
//「○○」に「××」の注記
////////////////////////////////
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("「○○」に「××」の注記"));
tabPanel.add(panel);
buttonGroup = new ButtonGroup();
jRadioChukiRuby0 = new JRadioButton("非表示", true);
jRadioChukiRuby0.setFocusPainted(false);
jRadioChukiRuby0.setIconTextGap(2);
jRadioChukiRuby0.setBorder(padding2);
panel.add(jRadioChukiRuby0);
buttonGroup.add(jRadioChukiRuby0);
jRadioChukiRuby1 = new JRadioButton("ルビ");
jRadioChukiRuby1.setToolTipText("○○のルビとして××を表示します(「ママ」の注記は非表示)");
jRadioChukiRuby1.setFocusPainted(false);
jRadioChukiRuby1.setIconTextGap(2);
jRadioChukiRuby1.setBorder(padding2);
panel.add(jRadioChukiRuby1);
buttonGroup.add(jRadioChukiRuby1);
jRadioChukiRuby2 = new JRadioButton("小書き");
jRadioChukiRuby2.setToolTipText("○○の後ろに××を小書きで表示します(「ママ」の注記は非表示)");
jRadioChukiRuby2.setFocusPainted(false);
jRadioChukiRuby2.setIconTextGap(2);
jRadioChukiRuby2.setBorder(padding2);
panel.add(jRadioChukiRuby2);
buttonGroup.add(jRadioChukiRuby2);
////////////////////////////////
//自動縦中横
////////////////////////////////
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("自動縦中横"));
tabPanel.add(panel);
//半角2文字縦書き
jCheckAutoYoko = new JCheckBox("有効 ", true);
jCheckAutoYoko.setFocusPainted(false);
jCheckAutoYoko.setToolTipText("半角の2文字の数字、2~3文字の!?を縦中横で表示します。(前後に半角が無い場合)");
jCheckAutoYoko.setBorder(padding2);
panel.add(jCheckAutoYoko);
label = new JLabel("+数字(");
label.setBorder(padding0);
panel.add(label);
//半角数字1文字縦書き
jCheckAutoYokoNum1 = new JCheckBox("1桁 ");
jCheckAutoYokoNum1.setFocusPainted(false);
jCheckAutoYokoNum1.setIconTextGap(1);
jCheckAutoYokoNum1.setBorder(padding2);
panel.add(jCheckAutoYokoNum1);
//半角数字3文字縦書き
jCheckAutoYokoNum3 = new JCheckBox("3桁");
jCheckAutoYokoNum3.setFocusPainted(false);
jCheckAutoYokoNum3.setIconTextGap(1);
jCheckAutoYokoNum3.setBorder(padding2);
panel.add(jCheckAutoYokoNum3);
label = new JLabel(") +");
label.setBorder(padding0);
panel.add(label);
//!? 1文字
jCheckAutoEQ1 = new JCheckBox("!? 1文字");
jCheckAutoEQ1.setFocusPainted(false);
jCheckAutoEQ1.setIconTextGap(3);
jCheckAutoEQ1.setBorder(padding2);
panel.add(jCheckAutoEQ1);
////////////////////////////////
//コメント出力
////////////////////////////////
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("コメントブロック出力"));
tabPanel.add(panel);
//半角2文字縦書き
jCheckCommentPrint = new JCheckBox("コメント出力 ");
jCheckCommentPrint.setToolTipText("コメント行の間を出力します");
jCheckCommentPrint.setFocusPainted(false);
jCheckCommentPrint.setBorder(padding2);
panel.add(jCheckCommentPrint);
//半角2文字縦書き
jCheckCommentConvert = new JCheckBox("コメント内注記変換");
jCheckCommentConvert.setToolTipText("コメント内の注記を変換します");
jCheckCommentConvert.setFocusPainted(false);
jCheckCommentConvert.setBorder(padding2);
panel.add(jCheckCommentConvert);
////////////////////////////////
//栞用ID出力
////////////////////////////////
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("栞用ID"));
tabPanel.add(panel);
jCheckMarkId = new JCheckBox("各行に出力");
jCheckMarkId.setToolTipText("Kobo向けの栞を記憶するためのIDを各行に設定します");
jCheckMarkId.setFocusPainted(false);
jCheckMarkId.setBorder(padding2);
panel.add(jCheckMarkId);
////////////////////////////////
//4バイト文字変換
////////////////////////////////
/*panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("4バイト文字"));
tabPanel.add(panel);
//4バイト文字を変換する
jCheckGaiji32 = new JCheckBox("出力する");
jCheckGaiji32.setToolTipText("u+20000以降の4バイト拡張漢字をそのまま出力します。Kobo等で表示できない場合はチェックを外します");
jCheckGaiji32.setFocusPainted(false);
jCheckGaiji32.setBorder(padding2);
panel.add(jCheckGaiji32);
*/
////////////////////////////////
//空行除去
////////////////////////////////
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("空行除去"));
tabPanel.add(panel);
jComboxRemoveEmptyLine = new JComboBox(new String[] { "0", "1", "2", "3", "4", "5" });
jComboxRemoveEmptyLine.setToolTipText("空行の行数を減らします 見出し行の後ろ3行以内は1行残します");
jComboxRemoveEmptyLine.setFocusable(false);
jComboxRemoveEmptyLine.setBorder(padding0);
jComboxRemoveEmptyLine.setMaximumSize(text5);
jComboxRemoveEmptyLine.setPreferredSize(text5);
((JLabel) jComboxRemoveEmptyLine.getRenderer()).setBorder(padding2);
panel.add(jComboxRemoveEmptyLine);
label = new JLabel("行減らす");
label.setBorder(padding2);
panel.add(label);
label = new JLabel(" 最大");
label.setBorder(padding2);
panel.add(label);
jComboxMaxEmptyLine = new JComboBox(new String[] { "-", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" });
jComboxMaxEmptyLine.setToolTipText("空行の連続を指定行数以下に制限します");
jComboxMaxEmptyLine.setFocusable(false);
jComboxMaxEmptyLine.setBorder(padding0);
jComboxMaxEmptyLine.setMaximumSize(text5);
jComboxMaxEmptyLine.setPreferredSize(text5);
panel.add(jComboxMaxEmptyLine);
label = new JLabel("行");
label.setBorder(padding2);
panel.add(label);
////////////////////////////////
//行頭字下げ追加
////////////////////////////////
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("行頭字下げ"));
tabPanel.add(panel);
jCheckForceIndent = new JCheckBox("有効 ");
jCheckForceIndent.setToolTipText("行頭が「『―”(〈〔【と全角空白以外なら行頭に全角空白を追加します 半角空白のみは全角に置き換えます");
jCheckForceIndent.setFocusPainted(false);
jCheckForceIndent.setBorder(padding2);
panel.add(jCheckForceIndent);
////////////////////////////////
//強制改ページ
////////////////////////////////
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("強制改ページ"));
tabPanel.add(panel);
jCheckPageBreak = new JCheckBox("有効", true);
jCheckPageBreak.setToolTipText("指定サイズを超えた時点で強制改ページ(ブロック注記の外側のみ)");
jCheckPageBreak.setFocusPainted(false);
jCheckPageBreak.setBorder(padding2);
jCheckPageBreak.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
boolean selected = jCheckPageBreak.isSelected();
jTextPageBreakSize.setEditable(selected);
jTextPageBreakEmptySize.setEditable(selected);
jTextPageBreakChapterSize.setEditable(selected);
}
});
panel.add(jCheckPageBreak);
jTextPageBreakSize = new JTextField("400");
jTextPageBreakSize.setMaximumSize(text4);
jTextPageBreakSize.setPreferredSize(text4);
jTextPageBreakSize.setInputVerifier(new IntegerInputVerifier(400, 1, 9999));
jTextPageBreakSize.setEditable(jCheckPageBreak.isSelected());
jTextPageBreakSize.addFocusListener(new TextSelectFocusListener(jTextPageBreakSize));
panel.add(jTextPageBreakSize);
label = new JLabel("KB ");
label.setBorder(padding2);
panel.add(label);
jCheckPageBreakEmpty = new JCheckBox("空行(");
jCheckPageBreakEmpty.setFocusPainted(false);
jCheckPageBreakEmpty.setBorder(padding2);
panel.add(jCheckPageBreakEmpty);
jComboxPageBreakEmptyLine = new JComboBox(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9" });
jComboxPageBreakEmptyLine.setSelectedIndex(1);
jComboxPageBreakEmptyLine.setFocusable(false);
jComboxPageBreakEmptyLine.setBorder(padding0);
jComboxPageBreakEmptyLine.setMaximumSize(text5);
jComboxPageBreakEmptyLine.setPreferredSize(text5);
((JLabel) jComboxPageBreakEmptyLine.getRenderer()).setBorder(padding2);
panel.add(jComboxPageBreakEmptyLine);
label = new JLabel("行以上 ");
label.setBorder(padding2);
panel.add(label);
jTextPageBreakEmptySize = new JTextField("300");
jTextPageBreakEmptySize.setMaximumSize(text4);
jTextPageBreakEmptySize.setPreferredSize(text4);
jTextPageBreakEmptySize.setInputVerifier(new IntegerInputVerifier(300, 1, 9999));
jTextPageBreakEmptySize.setEditable(jCheckPageBreak.isSelected());
jTextPageBreakEmptySize.addFocusListener(new TextSelectFocusListener(jTextPageBreakEmptySize));
panel.add(jTextPageBreakEmptySize);
label = new JLabel("KB) ");
label.setBorder(padding2);
panel.add(label);
jCheckPageBreakChapter = new JCheckBox("見出し前(");
jCheckPageBreakChapter.setFocusPainted(false);
jCheckPageBreakChapter.setBorder(padding2);
panel.add(jCheckPageBreakChapter);
jTextPageBreakChapterSize = new JTextField("200");
jTextPageBreakChapterSize.setMaximumSize(text4);
jTextPageBreakChapterSize.setPreferredSize(text4);
jTextPageBreakChapterSize.setInputVerifier(new IntegerInputVerifier(200, 1, 9999));
jTextPageBreakChapterSize.setEditable(jCheckPageBreak.isSelected());
jTextPageBreakChapterSize.addFocusListener(new TextSelectFocusListener(jTextPageBreakChapterSize));
panel.add(jTextPageBreakChapterSize);
label = new JLabel("KB) ");
label.setBorder(padding2);
panel.add(label);
////////////////////////////////////////////////////////////////
//Tab 目次設定
////////////////////////////////////////////////////////////////
tabPanel = new JPanel();
//tabPanel.setLayout(new BoxLayout(tabPanel, BoxLayout.Y_AXIS));
tabPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 0));
jTabbedPane.addTab("目次", tocIcon, tabPanel);
////////////////////////////////
//目次設定
////////////////////////////////
//目次出力
//目次抽出
panelV = new JPanel();
panelV.setLayout(new BoxLayout(panelV, BoxLayout.Y_AXIS));
panelV.setBorder(new NarrowTitledBorder("目次設定"));
tabPanel.add(panelV);
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
//最大文字数
label = new JLabel(" 最大文字数");
label.setBorder(padding2);
panel.add(label);
jTextMaxChapterNameLength = new JTextField("64");
jTextMaxChapterNameLength.setHorizontalAlignment(JTextField.RIGHT);
jTextMaxChapterNameLength.setInputVerifier(new IntegerInputVerifier(64, 1, 999));
jTextMaxChapterNameLength.setMaximumSize(text3);
jTextMaxChapterNameLength.setPreferredSize(text3);
jTextMaxChapterNameLength.addFocusListener(new TextSelectFocusListener(jTextMaxChapterNameLength));
panel.add(jTextMaxChapterNameLength);
label = new JLabel(" ");
label.setBorder(padding2);
panel.add(label);
//表紙
jCheckCoverPageToc = new JCheckBox("表紙 ");
jCheckCoverPageToc.setToolTipText("表紙画像のページを目次に追加します");
jCheckCoverPageToc.setFocusPainted(false);
jCheckCoverPageToc.setBorder(padding2);
panel.add(jCheckCoverPageToc);
//表紙
jCheckTitleToc = new JCheckBox("表題 ", true);
jCheckTitleToc.setToolTipText("表題の行を目次に追加します");
jCheckTitleToc.setFocusPainted(false);
jCheckTitleToc.setBorder(padding2);
panel.add(jCheckTitleToc);
jCheckChapterUseNextLine = new JCheckBox("次の行を繋げる ");
jCheckChapterUseNextLine.setToolTipText("次の行が空行でなければ見出しの後ろに繋げます");
jCheckChapterUseNextLine.setFocusPainted(false);
jCheckChapterUseNextLine.setBorder(padding2);
panel.add(jCheckChapterUseNextLine);
jCheckChapterExclude = new JCheckBox("連続する見出しを除外", true);
jCheckChapterExclude.setToolTipText("3つ以上連続する自動抽出された見出しを除外します(空行1行間隔も連続扱い)");
jCheckChapterExclude.setFocusPainted(false);
jCheckChapterExclude.setBorder(padding2);
panel.add(jCheckChapterExclude);
panelV.add(panel);
panel = new JPanel();
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 0));
//nav階層化
jCheckNavNest = new JCheckBox("目次ページ階層化 ");
jCheckNavNest.setToolTipText("目次ページ(nav.xhtml)を階層化します");
jCheckNavNest.setFocusPainted(false);
jCheckNavNest.setBorder(padding2);
panel.add(jCheckNavNest);
//表紙
jCheckNcxNest = new JCheckBox("目次(ncx)階層化 ");
jCheckNcxNest.setToolTipText("目次(toc.ncx)を階層化します");
jCheckNcxNest.setFocusPainted(false);
jCheckNcxNest.setBorder(padding2);
panel.add(jCheckNcxNest);
panelV.add(panel);
//目次抽出
panelV = new JPanel();
panelV.setLayout(new BoxLayout(panelV, BoxLayout.Y_AXIS));
panelV.setBorder(new NarrowTitledBorder("目次抽出"));
tabPanel.add(panelV);
panel = new JPanel();
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 0));
panel.setMaximumSize(panelVMaxSize);
panel.setBorder(padding3B);
panelV.add(panel);
//見出し注記
label = new JLabel("注記(");
label.setBorder(padding2);
panel.add(label);
jCheckChapterH = new JCheckBox("見出し ", true);
jCheckChapterH.setFocusPainted(false);
jCheckChapterH.setBorder(padding2);
panel.add(jCheckChapterH);
jCheckChapterH1 = new JCheckBox("大見出し ", true);
jCheckChapterH1.setFocusPainted(false);
jCheckChapterH1.setBorder(padding2);
panel.add(jCheckChapterH1);
jCheckChapterH2 = new JCheckBox("中見出し ", true);
jCheckChapterH2.setFocusPainted(false);
jCheckChapterH2.setBorder(padding2);
panel.add(jCheckChapterH2);
jCheckChapterH3 = new JCheckBox("小見出し ) ", true);
jCheckChapterH3.setFocusPainted(false);
jCheckChapterH3.setBorder(padding2);
panel.add(jCheckChapterH3);
jCheckSameLineChapter = new JCheckBox("同行見出し含む", false);
jCheckSameLineChapter.setFocusPainted(false);
jCheckSameLineChapter.setBorder(padding2);
panel.add(jCheckSameLineChapter);
panel = new JPanel();
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 0));
panel.setMaximumSize(panelVMaxSize);
panel.setBorder(padding3B);
panelV.add(panel);
//改ページ後を目次に追加
jCheckChapterSection = new JCheckBox("改ページ後 ", true);
jCheckChapterSection.setToolTipText("改ページ後の先頭行の文字を目次に出力します");
jCheckChapterSection.setFocusPainted(false);
jCheckChapterSection.setBorder(padding2);
panel.add(jCheckChapterSection);
jCheckChapterName = new JCheckBox("章見出し (第~章/その~/~章/序/プロローグ 等)", true);
jCheckChapterName.setToolTipText("第~話/第~章/第~篇/第~部/第~節/第~幕/第~編/その~/~章/プロローグ/エピローグ/モノローグ/序/序章/終章/転章/間章/幕間");
jCheckChapterName.setFocusPainted(false);
jCheckChapterName.setBorder(padding2);
panel.add(jCheckChapterName);
panel = new JPanel();
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 0));
panel.setMaximumSize(panelVMaxSize);
panel.setBorder(padding3B);
panelV.add(panel);
jCheckChapterNumOnly = new JCheckBox("数字のみ");
jCheckChapterNumOnly.setFocusPainted(false);
jCheckChapterNumOnly.setBorder(padding2);
panel.add(jCheckChapterNumOnly);
jCheckChapterNumTitle = new JCheckBox("数字+見出し ");
jCheckChapterNumTitle.setFocusPainted(false);
jCheckChapterNumTitle.setBorder(padding2);
panel.add(jCheckChapterNumTitle);
jCheckChapterNumParen = new JCheckBox("括弧内数字のみ");
jCheckChapterNumParen.setToolTipText("()〈〉〔〕【】内の数字");
jCheckChapterNumParen.setFocusPainted(false);
jCheckChapterNumParen.setBorder(padding2);
panel.add(jCheckChapterNumParen);
jCheckChapterNumParenTitle = new JCheckBox("括弧内数字+見出し");
jCheckChapterNumParenTitle.setFocusPainted(false);
jCheckChapterNumParenTitle.setBorder(padding2);
panel.add(jCheckChapterNumParenTitle);
panel = new JPanel();
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 0));
panel.setMaximumSize(panelVMaxSize);
panel.setBorder(padding0);
panelV.add(panel);
jCheckChapterPattern = new JCheckBox("その他パターン");
jCheckChapterPattern.setToolTipText("目次抽出パターンを正規表現で指定します。前後の空白とタグを除いた文字列と比較します。");
jCheckChapterPattern.setFocusPainted(false);
jCheckChapterPattern.setBorder(padding2);
jCheckChapterPattern.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
jComboChapterPattern.setEditable(jCheckChapterPattern.isSelected());
jComboChapterPattern.repaint();
}
});
panel.add(jCheckChapterPattern);
jComboChapterPattern = new JComboBox(new String[] { "^(見出し1|見出し2|見出し3)$", "^(†|【|●|▼|■)", "^(0-9|0-9|一|二|三|四|五|六|七|八|九|十|〇)", "^[1|2|1|2]?[0-9|0-9]月[1-3|1-3]?[0-9|0-9]日", "^(一|十)?(一|二|三|四|五|六|七|八|九|十|〇)月(一|十|二十?|三十?)?(一|二|三|四|五|六|七|八|九|十|〇)日" });
jComboChapterPattern.setBorder(padding0);
jComboChapterPattern.setMaximumSize(text300);
jComboChapterPattern.setPreferredSize(text300);
jComboChapterPattern.setEditable(jCheckChapterPattern.isSelected());
panel.add(jComboChapterPattern);
////////////////////////////////////////////////////////////////
//Tab スタイル
////////////////////////////////////////////////////////////////
tabPanel = new JPanel();
tabPanel.setLayout(new BoxLayout(tabPanel, BoxLayout.Y_AXIS));
tabPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 0));
jTabbedPane.addTab("スタイル", styleIcon, tabPanel);
////////////////////////////////
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("行の高さ"));
tabPanel.add(panel);
jComboLineHeight = new JComboBox(new String[] { "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "2.0" });
jComboLineHeight.setBorder(padding0);
jComboLineHeight.setMaximumSize(combo3);
jComboLineHeight.setPreferredSize(combo3);
jComboLineHeight.setEditable(true);
jComboLineHeight.setInputVerifier(new FloatInputVerifier(1.8f, 1));
jComboLineHeight.setSelectedItem("1.8");
panel.add(jComboLineHeight);
label = new JLabel("文字");
label.setBorder(padding2);
panel.add(label);
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("文字サイズ"));
tabPanel.add(panel);
jComboFontSize = new JComboBox(new String[] { "75", "80", "85", "90", "95", "100", "105", "110", "115", "120", "125" });
jComboFontSize.setToolTipText("標準フォントからの倍率を設定します");
jComboFontSize.setBorder(padding0);
jComboFontSize.setMaximumSize(combo3);
jComboFontSize.setPreferredSize(combo3);
jComboFontSize.setEditable(true);
jComboFontSize.setInputVerifier(new IntegerInputVerifier(100, 10));
jComboFontSize.setSelectedItem("100");
panel.add(jComboFontSize);
label = new JLabel("%");
label.setBorder(padding2);
panel.add(label);
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("太字ゴシック表示"));
tabPanel.add(panel);
jCheckBoldUseGothic = new JCheckBox("太字注記", false);
jCheckBoldUseGothic.setToolTipText("太字注記を太字ゴシックで表示します");
jCheckBoldUseGothic.setFocusPainted(false);
jCheckBoldUseGothic.setBorder(padding2);
panel.add(jCheckBoldUseGothic);
jCheckGothicUseBold = new JCheckBox("ゴシック体注記", false);
jCheckGothicUseBold.setToolTipText("ゴシック体注記を太字ゴシックで表示します");
jCheckGothicUseBold.setFocusPainted(false);
jCheckGothicUseBold.setBorder(padding2);
panel.add(jCheckGothicUseBold);
////////////////////////////////
//余白設定 横に並べる
panelH = new JPanel();
panelH.setLayout(new BoxLayout(panelH, BoxLayout.X_AXIS));
tabPanel.add(panelH);
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("テキスト余白 (@page margin)"));
panelH.add(panel);
String[] marginLabels = { "上", "右", "下", "左" };
jTextPageMargins = new JTextField[4];
NumberVerifier numberVerifier0 = new NumberVerifier(0, 0);
for (int i = 0; i < jTextPageMargins.length; i++) {
label = new JLabel(marginLabels[i]);
label.setBorder(padding2);
panel.add(label);
JTextField jTextField = new JTextField("0.5");
jTextPageMargins[i] = jTextField;
jTextField.setHorizontalAlignment(JTextField.RIGHT);
jTextField.addFocusListener(new TextSelectFocusListener(jTextField));
jTextField.setInputVerifier(numberVerifier0);
jTextField.setMaximumSize(text3);
jTextField.setPreferredSize(text3);
panel.add(jTextField);
}
panel.add(new JLabel(" "));
ButtonGroup group = new ButtonGroup();
jRadioPageMarginUnit0 = new JRadioButton("字 ", true);
jRadioPageMarginUnit0.setBorder(padding0);
jRadioPageMarginUnit0.setFocusPainted(false);
panel.add(jRadioPageMarginUnit0);
group.add(jRadioPageMarginUnit0);
jRadioPageMarginUnit1 = new JRadioButton("%");
jRadioPageMarginUnit1.setBorder(padding0);
jRadioPageMarginUnit1.setFocusPainted(false);
panel.add(jRadioPageMarginUnit1);
group.add(jRadioPageMarginUnit1);
////////////////////////////////
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("テキスト余白 (html margin) Reader用"));
panelH.add(panel);
jTextBodyMargins = new JTextField[4];
for (int i = 0; i < jTextBodyMargins.length; i++) {
label = new JLabel(marginLabels[i]);
label.setBorder(padding2);
panel.add(label);
JTextField jTextField = new JTextField("0");
jTextBodyMargins[i] = jTextField;
jTextField.setHorizontalAlignment(JTextField.RIGHT);
jTextField.addFocusListener(new TextSelectFocusListener(jTextField));
jTextField.setInputVerifier(numberVerifier0);
jTextField.setMaximumSize(text3);
jTextField.setPreferredSize(text3);
panel.add(jTextField);
}
panel.add(new JLabel(" "));
group = new ButtonGroup();
jRadioBodyMarginUnit0 = new JRadioButton("字 ", true);
jRadioBodyMarginUnit0.setBorder(padding0);
jRadioBodyMarginUnit0.setFocusPainted(false);
panel.add(jRadioBodyMarginUnit0);
group.add(jRadioBodyMarginUnit0);
jRadioBodyMarginUnit1 = new JRadioButton("%");
jRadioBodyMarginUnit1.setBorder(padding0);
jRadioBodyMarginUnit1.setFocusPainted(false);
panel.add(jRadioBodyMarginUnit1);
group.add(jRadioBodyMarginUnit1);
////////////////////////////////////////////////////////////////
//Tab 文字出力
////////////////////////////////////////////////////////////////
/*tabPanel = new JPanel();
//tabPanel.setLayout(new BoxLayout(tabPanel, BoxLayout.Y_AXIS));
tabPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 0));
jTabbedPane.addTab("文字", charIcon, tabPanel);
*/
//スタイルタブの下に追加
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("濁点/半濁点文字"));
tabPanel.add(panel);
group = new ButtonGroup();
jRadioDakutenType0 = new JRadioButton("そのまま");
jRadioDakutenType0.setToolTipText("結合文字は通常の文字に変換されます");
jRadioDakutenType0.setBorder(padding2);
jRadioDakutenType0.setFocusPainted(false);
panel.add(jRadioDakutenType0);
group.add(jRadioDakutenType0);
jRadioDakutenType1 = new JRadioButton("重ねる", true);
jRadioDakutenType1.setToolTipText("Reader,Kobo,Kindle以外はずれる場合があります。ルビ内はそのまま出力します");
jRadioDakutenType1.setBorder(padding2);
jRadioDakutenType1.setFocusPainted(false);
panel.add(jRadioDakutenType1);
group.add(jRadioDakutenType1);
jRadioDakutenType2 = new JRadioButton("フォント", true);
jRadioDakutenType2.setToolTipText("一文字フォントを利用します。端末によっては太字斜体表示できません");
jRadioDakutenType2.setBorder(padding2);
jRadioDakutenType2.setFocusPainted(false);
panel.add(jRadioDakutenType2);
group.add(jRadioDakutenType2);
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("IVS出力(Kobo,Kindle非対応)"));
tabPanel.add(panel);
jCheckIvsBMP = new JCheckBox("英数字用(U+FE00-FE0E)", false);
jCheckIvsBMP.setToolTipText("英数字、絵文字向けのIVSを出力します");
jCheckIvsBMP.setFocusPainted(false);
jCheckIvsBMP.setBorder(padding2);
panel.add(jCheckIvsBMP);
jCheckIvsSSP = new JCheckBox("漢字用(U+E0100-E01EF)", false);
jCheckIvsSSP.setToolTipText("漢字用のIVSを出力します");
jCheckIvsSSP.setFocusPainted(false);
jCheckIvsSSP.setBorder(padding2);
panel.add(jCheckIvsSSP);
////////////////////////////////////////////////////////////////
//Tab Web小説
////////////////////////////////////////////////////////////////
tabPanel = new JPanel();
//tabPanel.setLayout(new BoxLayout(tabPanel, BoxLayout.Y_AXIS));
tabPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 0));
jTabbedPane.addTab("Web", webIcon, tabPanel);
////////////////////////////////
//取得間隔
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("取得設定"));
tabPanel.add(panel);
label = new JLabel("取得間隔");
label.setBorder(padding2);
label.setToolTipText("Web小説の取得間隔を設定します");
panel.add(label);
jTextWebInterval = new JTextField("0.5");
jTextWebInterval.setToolTipText(label.getToolTipText());
jTextWebInterval.setHorizontalAlignment(JTextField.RIGHT);
jTextWebInterval.setInputVerifier(new FloatInputVerifier(0.5f, 0, 60));
jTextWebInterval.setMaximumSize(text3);
jTextWebInterval.setPreferredSize(text3);
jTextWebInterval.addFocusListener(new TextSelectFocusListener(jTextWebInterval));
panel.add(jTextWebInterval);
label = new JLabel("秒");
label.setBorder(padding1);
panel.add(label);
//キャッシュ保存先
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("キャッシュ保存パス"));
tabPanel.add(panel);
jTextCachePath = new JTextField(".cache");
jTextCachePath.setToolTipText("キャッシュファイルを保存するパスです。フルパスまたは起動パスからの相対パスを指定します");
jTextCachePath.setMaximumSize(text300);
jTextCachePath.setPreferredSize(text300);
jTextCachePath.addFocusListener(new TextSelectFocusListener(jTextCachePath));
panel.add(jTextCachePath);
jButtonCachePath = new JButton("選択");
jButtonCachePath.setBorder(padding2);
jButtonCachePath.setIcon(new ImageIcon(AozoraEpub3Applet.class.getResource("images/dst_path.png")));
jButtonCachePath.setFocusPainted(false);
jButtonCachePath.addActionListener(new CachePathChooserListener(jButtonCachePath));
panel.add(jButtonCachePath);
//未更新時のスキップ
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("更新判定"));
tabPanel.add(panel);
jTextWebModifiedExpire = new JTextField("24");
jTextWebModifiedExpire.setToolTipText("この時間以内に取得したキャッシュを更新分として処理します");
jTextWebModifiedExpire.setHorizontalAlignment(JTextField.RIGHT);
jTextWebModifiedExpire.setInputVerifier(new NumberVerifier(24, 0, 9999));
jTextWebModifiedExpire.setMaximumSize(text4);
jTextWebModifiedExpire.setPreferredSize(text4);
jTextWebModifiedExpire.addFocusListener(new TextSelectFocusListener(jTextWebModifiedExpire));
panel.add(jTextWebModifiedExpire);
label = new JLabel("時間以内");
label.setBorder(padding1);
label.setToolTipText(jTextWebModifiedExpire.getToolTipText());
panel.add(label);
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("ePub出力設定"));
tabPanel.add(panel);
jCheckWebConvertUpdated = new JCheckBox("更新時のみ出力");
jCheckWebConvertUpdated.setToolTipText("新規追加または一覧ページで更新がある場合のみePubファイルを出力します");
jCheckWebConvertUpdated.setFocusPainted(false);
jCheckWebConvertUpdated.setBorder(padding2);
panel.add(jCheckWebConvertUpdated);
//変換対象
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.setBorder(new NarrowTitledBorder("変換対象"));
tabPanel.add(panel);
jCheckWebBeforeChapter = new JCheckBox("最新");
jCheckWebBeforeChapter.setToolTipText("最新話から指定話数のみ出力します。追加更新分のみの出力がある場合はそれに追加されます");
jCheckWebBeforeChapter.setFocusPainted(false);
jCheckWebBeforeChapter.setBorder(padding0);
jCheckWebBeforeChapter.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
jTextWebBeforeChapterCount.setEditable(jCheckWebBeforeChapter.isSelected());
jTextWebBeforeChapterCount.repaint();
}
});
panel.add(jCheckWebBeforeChapter);
jTextWebBeforeChapterCount = new JTextField("1");
jTextWebBeforeChapterCount.setToolTipText(jCheckWebBeforeChapter.getToolTipText());
jTextWebBeforeChapterCount.setEditable(false);
jTextWebBeforeChapterCount.setHorizontalAlignment(JTextField.RIGHT);
jTextWebBeforeChapterCount.setInputVerifier(new IntegerInputVerifier(0, 0, 999));
jTextWebBeforeChapterCount.setMaximumSize(text3);
jTextWebBeforeChapterCount.setPreferredSize(text3);
jTextWebBeforeChapterCount.addFocusListener(new TextSelectFocusListener(jTextWebBeforeChapterCount));
panel.add(jTextWebBeforeChapterCount);
label = new JLabel("話 +");
label.setBorder(padding1);
panel.add(label);
jCheckWebModifiedOnly = new JCheckBox("更新分");
jCheckWebModifiedOnly.setToolTipText("追加更新のあった話のみ変換します");
jCheckWebModifiedOnly.setFocusPainted(false);
jCheckWebModifiedOnly.setBorder(padding2);
panel.add(jCheckWebModifiedOnly);
panel.add(new JLabel("("));
jCheckWebModifiedTail = new JCheckBox("連続");
jCheckWebModifiedTail.setToolTipText("最新話から連続した更新分のみ変換します。途中話の更新は変換されません");
jCheckWebModifiedTail.setFocusPainted(false);
jCheckWebModifiedTail.setBorder(padding2);
panel.add(jCheckWebModifiedTail);
panel.add(new JLabel(")"));
////////////////////////////////////////////////////////////////
//テキストエリア
////////////////////////////////////////////////////////////////
JPanel lowerPane = new JPanel();
lowerPane.setLayout(new BoxLayout(lowerPane, BoxLayout.Y_AXIS));
jSplitPane.add(lowerPane);
jTextArea = new JTextArea("AozoraEpub3: " + AozoraEpub3.VERSION);
jTextArea.append(" ( Java " + System.getProperty("java.version"));
jTextArea.append(" / " + System.getProperty("os.name"));
jTextArea.append(" )\n対応ファイル: 青空文庫txt(txt,zip,rar), 画像(zip,rar,cbz), URLショートカット(url)\n");
jTextArea.append("ファイルまたはURL文字列をここにドラッグ&ドロップ/ペーストで変換します。\n");
jTextArea.setEditable(false);
jTextArea.setFont(new Font("Default", Font.PLAIN, 12));
jTextArea.setBorder(new LineBorder(Color.white, 3));
//new DropTarget(jTextArea, DnDConstants.ACTION_COPY_OR_MOVE, new DropListener(), true);
jTextArea.setTransferHandler(new TextAreaTransferHandler("text"));
jTextArea.getActionMap().put("copy-text", new CopyTextAction());
jTextArea.getActionMap().put("paste-url", new PasteUrlAction());
// create new inputmap locally
InputMap jtxInputMap = new InputMap();
jtxInputMap.setParent(jTextArea.getInputMap());
jtxInputMap.put(KeyStroke.getKeyStroke("ctrl C"), "copy-text");
jtxInputMap.put(KeyStroke.getKeyStroke("ctrl V"), "paste-url");
jTextArea.setInputMap(JComponent.WHEN_FOCUSED, jtxInputMap);
//メニュー
JMenuItem jCopyMenu = new JMenuItem("コピー");
jCopyMenu.setIcon(new ImageIcon(AozoraEpub3Applet.class.getResource("images/copy.png")));
jCopyMenu.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
String selected = jTextArea.getSelectedText();
if (!"".equals(selected)) {
getToolkit().getSystemClipboard().setContents(new StringSelection(selected), null);
}
}
});
JMenuItem jPasteMenu = new JMenuItem("貼り付け");
jPasteMenu.setIcon(new ImageIcon(AozoraEpub3Applet.class.getResource("images/paste.png")));
jPasteMenu.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
handleTextAreaTransfer(getToolkit().getSystemClipboard().getContents(jTextArea));
}
});
final JPopupMenu jTextPopup = new JPopupMenu();
jTextPopup.add(jCopyMenu);
jTextPopup.add(jPasteMenu);
jTextArea.addMouseListener(new MouseListener() {
public void mouseReleased(MouseEvent e) {
}
public void mousePressed(MouseEvent e) {
if (SwingUtilities.isRightMouseButton(e)) {
jTextPopup.show(jTextArea, e.getX(), e.getY());
}
}
public void mouseExited(MouseEvent e) {
}
public void mouseEntered(MouseEvent e) {
}
public void mouseClicked(MouseEvent e) {
}
});
lowerPane.add(new JScrollPane(jTextArea));
////////////////////////////////////////////////////////////////
//画面下 ステータス
////////////////////////////////////////////////////////////////
JPanel statusPane = new JPanel();
statusPane.setLayout(new BoxLayout(statusPane, BoxLayout.X_AXIS));
statusPane.setMaximumSize(new Dimension(1920, 22));
statusPane.setPreferredSize(new Dimension(1920, 22));
statusPane.setBorder(padding2H);
lowerPane.add(statusPane);
////////////////////////////////
//プログレスバー
panel = new JPanel();
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 0));
panel.setBorder(BorderFactory.createEmptyBorder(1, 2, 0, 2));
statusPane.add(panel);
jProgressBar = new JProgressBar(0, 100);
jProgressBar.setMaximumSize(new Dimension(200, 20));
jProgressBar.setPreferredSize(new Dimension(200, 20));
panel.add(jProgressBar);
label = new JLabel(" ");
label.setBorder(padding2H);
panel.add(label);
jButtonCancel = new JButton("処理中止");
jButtonCancel.setBorder(padding2);
jButtonCancel.setIcon(new ImageIcon(AozoraEpub3Applet.class.getResource("images/cancel.png")));
jButtonCancel.setFocusPainted(false);
jButtonCancel.setEnabled(false);
jButtonCancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
epub3Writer.cancel();
epub3ImageWriter.cancel();
aozoraConverter.cancel();
convertCanceled = true;
if (webConverter != null)
webConverter.canceled();
if (kindleProcess != null)
kindleProcess.destroy();
}
});
panel.add(jButtonCancel);
////////////////////////////////
//右パネル
panel = new JPanel();
panel.setLayout(new FlowLayout(FlowLayout.RIGHT, 1, 0));
panel.setBorder(BorderFactory.createEmptyBorder(1, 2, 0, 2));
statusPane.add(panel);
//変換前に確認
jCheckConfirm = new JCheckBox("変換前確認", true);
jCheckConfirm.setToolTipText("変換前にタイトルと表紙の設定が可能な確認画面を表示します");
jCheckConfirm.setFocusPainted(false);
jCheckConfirm.setBorder(padding0);
panel.add(jCheckConfirm);
//ログ関連
label = new JLabel(" ログ:");
label.setBorder(padding2H);
panel.add(label);
JButton jButtonLogClear = new JButton();
jButtonLogClear.setToolTipText("ログを削除してクリップボードにコピーします");
jButtonLogClear.setBorder(padding2);
jButtonLogClear.setIcon(new ImageIcon(AozoraEpub3Applet.class.getResource("images/del_cut.png")));
jButtonLogClear.setFocusPainted(false);
jButtonLogClear.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String text = jTextArea.getText();
jTextArea.setText("");
try {
Clipboard systemClipboard = getToolkit().getSystemClipboard();
StringSelection responseURLString = new StringSelection(text);
systemClipboard.setContents(responseURLString, null);
} catch (Exception e2) {
e2.printStackTrace();
}
if (!jButtonCancel.isEnabled()) {
jProgressBar.setValue(0);
jProgressBar.setStringPainted(false);
}
}
});
panel.add(jButtonLogClear);
////////////////////////////////////////////////////////////////
//確認ダイアログ
////////////////////////////////////////////////////////////////
jConfirmDialog = new JConfirmDialog(iconImage, AozoraEpub3Applet.class.getResource("images/icon.png").toString().replaceFirst("/icon\\.png", "/"));
if ("1".equals(props.getProperty("ReplaceCover")))
jConfirmDialog.jCheckReplaceCover.setSelected(true);
////////////////////////////////////////////////////////////////
//iniファイルの中身を設定
////////////////////////////////////////////////////////////////
loadProperties(this.props);
//変換前確認の設定
setPropsSelected(this.jCheckConfirm, props, "ChkConfirm");
////////////////////////////////////////////////////////////////
//ログ出力先を設定
////////////////////////////////////////////////////////////////
LogAppender.setTextArea(jTextArea);
//初期化
try {
//ePub出力クラス初期化
this.epub3Writer = new Epub3Writer(this.jarPath + "template/");
this.epub3Writer.setProgressBar(jProgressBar);
//ePub画像出力クラス初期化
this.epub3ImageWriter = new Epub3ImageWriter(this.jarPath + "template/");
this.epub3ImageWriter.setProgressBar(jProgressBar);
//変換テーブルをstaticに生成
this.aozoraConverter = new AozoraEpub3Converter(this.epub3Writer, this.jarPath);
} catch (IOException e) {
e.printStackTrace();
jTextArea.append(e.getMessage());
}
////////////////////////////////////////////////////////////////
//すべて初期化にプロファイル読み込み
////////////////////////////////////////////////////////////////
//前回選択されていたプロファイル
String selectedProfileFileName = this.props.getProperty("ProfileFileName");
//並び順取得
Vector<File> propFiles = new Vector<File>();
HashSet<String> profileFileNameMap = new HashSet<String>();
if (this.props.containsKey("ProfileList")) {
for (String fileName : this.props.getProperty("ProfileList").split(",")) {
File file = new File(profilePath.getPath() + "/" + fileName);
if (file.isFile()) {
propFiles.add(file);
profileFileNameMap.add(file.getName());
}
}
}
//まだ追加されていないファイルを追加
for (File file : profilePath.listFiles()) {
if (!profileFileNameMap.contains(file.getName())) {
propFiles.add(file);
}
}
profileFileNameMap.clear();
//保存済プロファイルの名称を取得してコンボボックスに追加
for (File profile : propFiles) {
Properties profileProps = new Properties();
try {
FileInputStream fos = new FileInputStream(profile);
profileProps.load(fos);
fos.close();
} catch (Exception e) {
}
String name = profileProps.getProperty("ProfileName");
if (name != null && name.length() > 0) {
jComboProfile.addItem(new ProfileInfo(profile.getName(), name, profileProps));
//選択
if (profile.getName().equals(selectedProfileFileName)) {
jComboProfile.setSelectedIndex(jComboProfile.getItemCount() - 1);
}
} else {
//名前がなければ起動時に削除
profile.delete();
}
}
//何もなければデフォルト設定を追加
if (jComboProfile.getItemCount() == 0) {
try {
addProfile("デフォルト");
} catch (Exception e) {
e.printStackTrace();
}
}
//選択済プロファイル保存
selectedProfile = (ProfileInfo) jComboProfile.getSelectedItem();
//追加後にイベント有効
jComboProfile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
try {
if (jComboProfile.getSelectedItem() instanceof ProfileInfo) {
//選択済のプロファイルを更新
if (selectedProfile != null) {
setProperties(selectedProfile.getProperties());
selectedProfile.update(profilePath);
}
ProfileInfo propInfo = (ProfileInfo) jComboProfile.getSelectedItem();
loadProperties(propInfo.getProperties());
//選択済入れ替え
selectedProfile = propInfo;
}
//移動ボタン有効化
setProfileMoveEnable();
} catch (Exception e) {
e.printStackTrace();
}
}
});
//移動ボタン有効化
setProfileMoveEnable();
}
use of javax.swing.border.LineBorder in project azure-tools-for-java by Microsoft.
the class DatePickerCellEditor method getTableCellEditorComponent.
@Override
public Component getTableCellEditorComponent(JTable jTable, Object value, boolean b, int row, int col) {
this.value = null;
((JComponent) this.getComponent()).setBorder(new LineBorder(JBColor.BLACK));
try {
Class columnClass = jTable.getColumnClass(col);
if (columnClass == Object.class) {
columnClass = String.class;
}
checkPackageAccess(columnClass);
checkAccess(columnClass.getModifiers());
this.constructor = columnClass.getConstructor(String.class);
} catch (Exception ignored) {
return null;
}
final Component component = super.getTableCellEditorComponent(jTable, value, b, row, col);
if (!isCellDate(jTable, row, col)) {
return component;
}
JButton button = new JButton("...");
button.setPreferredSize(new Dimension(button.getPreferredSize().height, 40));
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
final JXMonthView monthView = new JXMonthView();
monthView.setSelectionMode(DateSelectionModel.SelectionMode.SINGLE_SELECTION);
monthView.setTraversable(true);
monthView.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
String date = new SimpleDateFormat().format(monthView.getSelectionDate());
((JTextField) component).setText(date);
}
});
JDialog frame = new JDialog();
frame.getContentPane().add(monthView);
frame.setModal(true);
frame.setAlwaysOnTop(true);
frame.setMinimumSize(monthView.getPreferredSize());
frame.pack();
frame.setLocation((Toolkit.getDefaultToolkit().getScreenSize().width) / 2 - frame.getWidth() / 2, (Toolkit.getDefaultToolkit().getScreenSize().height) / 2 - frame.getHeight() / 2);
frame.setVisible(true);
}
});
JPanel panel = new JPanel(new BorderLayout());
panel.add(component, BorderLayout.CENTER);
panel.add(button, BorderLayout.LINE_END);
return panel;
}
use of javax.swing.border.LineBorder in project intellij-community by JetBrains.
the class ArtifactEditorImpl method createMainComponent.
public JComponent createMainComponent() {
mySourceItemsTree.initTree();
myLayoutTreeComponent.initTree();
DataManager.registerDataProvider(myMainPanel, new TypeSafeDataProviderAdapter(new MyDataProvider()));
myErrorPanelPlace.add(myValidationManager.getMainErrorPanel(), BorderLayout.CENTER);
final JBSplitter splitter = new OnePixelSplitter(false);
final JPanel leftPanel = new JPanel(new BorderLayout());
JPanel treePanel = myLayoutTreeComponent.getTreePanel();
if (UIUtil.isUnderDarcula()) {
treePanel.setBorder(new EmptyBorder(3, 0, 0, 0));
} else {
treePanel.setBorder(new LineBorder(UIUtil.getBorderColor()));
}
leftPanel.add(treePanel, BorderLayout.CENTER);
if (UIUtil.isUnderDarcula()) {
CompoundBorder border = new CompoundBorder(new CustomLineBorder(0, 0, 0, 1), BorderFactory.createEmptyBorder(0, 0, 0, 0));
leftPanel.setBorder(border);
} else {
leftPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 0));
}
splitter.setFirstComponent(leftPanel);
final JPanel rightPanel = new JPanel(new BorderLayout());
final JPanel rightTopPanel = new JPanel(new BorderLayout());
final JPanel labelPanel = new JPanel();
labelPanel.setLayout(new BoxLayout(labelPanel, BoxLayout.X_AXIS));
labelPanel.add(new JLabel("Available Elements "));
final HyperlinkLabel link = new HyperlinkLabel("");
link.setIcon(AllIcons.General.Help_small);
link.setUseIconAsLink(true);
link.addHyperlinkListener(new HyperlinkAdapter() {
@Override
protected void hyperlinkActivated(HyperlinkEvent e) {
final JLabel label = new JLabel(ProjectBundle.message("artifact.source.items.tree.tooltip"));
label.setBorder(HintUtil.createHintBorder());
label.setBackground(HintUtil.getInformationColor());
label.setOpaque(true);
HintManager.getInstance().showHint(label, RelativePoint.getSouthWestOf(link), HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE, -1);
}
});
labelPanel.add(link);
rightTopPanel.add(labelPanel, BorderLayout.CENTER);
rightPanel.add(rightTopPanel, BorderLayout.NORTH);
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(mySourceItemsTree, true);
JPanel scrollPaneWrap = new JPanel(new BorderLayout());
scrollPaneWrap.add(scrollPane, BorderLayout.CENTER);
if (UIUtil.isUnderDarcula()) {
scrollPaneWrap.setBorder(new EmptyBorder(3, 0, 0, 0));
} else {
scrollPaneWrap.setBorder(new LineBorder(UIUtil.getBorderColor()));
}
rightPanel.add(scrollPaneWrap, BorderLayout.CENTER);
if (UIUtil.isUnderDarcula()) {
rightPanel.setBorder(new CompoundBorder(new CustomLineBorder(0, 1, 0, 0), BorderFactory.createEmptyBorder(0, 0, 0, 0)));
} else {
rightPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 3));
}
splitter.setSecondComponent(rightPanel);
splitter.getDivider().setBackground(UIUtil.getPanelBackground());
treePanel.setBorder(JBUI.Borders.empty());
rightPanel.setBorder(JBUI.Borders.empty());
scrollPaneWrap.setBorder(JBUI.Borders.empty());
leftPanel.setBorder(JBUI.Borders.empty());
myShowContentCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final ThreeStateCheckBox.State state = myShowContentCheckBox.getState();
if (state == ThreeStateCheckBox.State.SELECTED) {
mySubstitutionParameters.setSubstituteAll();
} else if (state == ThreeStateCheckBox.State.NOT_SELECTED) {
mySubstitutionParameters.setSubstituteNone();
}
myShowContentCheckBox.setThirdStateEnabled(false);
myLayoutTreeComponent.rebuildTree();
onShowContentSettingsChanged();
}
});
ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, createToolbarActionGroup(), true);
JComponent toolbarComponent = toolbar.getComponent();
if (UIUtil.isUnderDarcula()) {
toolbarComponent.setBorder(new CustomLineBorder(0, 0, 1, 0));
}
leftPanel.add(toolbarComponent, BorderLayout.NORTH);
toolbar.updateActionsImmediately();
rightTopPanel.setPreferredSize(new Dimension(-1, toolbarComponent.getPreferredSize().height));
myTabbedPane = new TabbedPaneWrapper(this);
myTabbedPane.addTab("Output Layout", splitter);
myPropertiesEditors.addTabs(myTabbedPane);
myEditorPanel.add(myTabbedPane.getComponent(), BorderLayout.CENTER);
final LayoutTree tree = myLayoutTreeComponent.getLayoutTree();
new ShowAddPackagingElementPopupAction(this).registerCustomShortcutSet(CommonShortcuts.getNew(), tree);
PopupHandler.installPopupHandler(tree, createPopupActionGroup(), ActionPlaces.UNKNOWN, ActionManager.getInstance());
ToolTipManager.sharedInstance().registerComponent(tree);
rebuildTries();
return getMainComponent();
}
use of javax.swing.border.LineBorder in project intellij-community by JetBrains.
the class InplaceRefactoring method createPreviewComponent.
public static EditorEx createPreviewComponent(Project project, FileType languageFileType) {
Document document = EditorFactory.getInstance().createDocument("");
UndoUtil.disableUndoFor(document);
EditorEx previewEditor = (EditorEx) EditorFactory.getInstance().createEditor(document, project, languageFileType, true);
previewEditor.setOneLineMode(true);
final EditorSettings settings = previewEditor.getSettings();
settings.setAdditionalLinesCount(0);
settings.setAdditionalColumnsCount(1);
settings.setRightMarginShown(false);
settings.setFoldingOutlineShown(false);
settings.setLineNumbersShown(false);
settings.setLineMarkerAreaShown(false);
settings.setIndentGuidesShown(false);
settings.setVirtualSpace(false);
previewEditor.setHorizontalScrollbarVisible(false);
previewEditor.setVerticalScrollbarVisible(false);
previewEditor.setCaretEnabled(false);
settings.setLineCursorWidth(1);
final Color bg = previewEditor.getColorsScheme().getColor(EditorColors.CARET_ROW_COLOR);
previewEditor.setBackgroundColor(bg);
previewEditor.setBorder(BorderFactory.createCompoundBorder(new DottedBorder(Color.gray), new LineBorder(bg, 2)));
return previewEditor;
}
use of javax.swing.border.LineBorder in project intellij-community by JetBrains.
the class ArrayTableCellRenderer method getTableCellRendererComponent.
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
if (value != null) {
setText(value.toString());
}
if (hasFocus) {
this.setBorder(new LineBorder(JBColor.BLUE, 2));
}
if (myMax != myMin) {
if (myColored && value != null) {
try {
double rangedValue = PyNumericViewUtil.getRangedValue(value.toString(), myType, myMin, myMax, myComplexMax, myComplexMin);
this.setBackground(PyNumericViewUtil.rangedValueToColor(rangedValue));
} catch (NumberFormatException ignored) {
}
} else {
this.setBackground(UIUtil.getBgFillColor(table));
}
}
return this;
}
Aggregations