use of javax.swing.JProgressBar in project triplea by triplea-game.
the class MapDownloadProgressPanel method addDownload.
private MapDownloadProgressListener addDownload(final DownloadFileDescription download) {
assert SwingUtilities.isEventDispatchThread();
// add new downloads to the head of the list, this will allow the user to see newly added items directly,
// rather than having to scroll down to see new items.
downloadList.add(0, download);
// space at the end of the label so the text does not end right at the progress bar
labels.put(download, new JLabel(download.getMapName() + " "));
final JProgressBar progressBar = new JProgressBar();
progressBars.put(download, progressBar);
rebuildPanel();
return new MapDownloadProgressListener(download, progressBar);
}
use of javax.swing.JProgressBar in project triplea by triplea-game.
the class ProgressDialog method createContent.
private static Component createContent(final String message) {
final JPanel panel = new JPanel();
panel.setBorder(new LineBorder(Color.BLACK));
panel.setLayout(new BorderLayout());
final JLabel label = new JLabel(message);
label.setBorder(new EmptyBorder(10, 10, 10, 10));
panel.add(BorderLayout.NORTH, label);
final JProgressBar progressBar = new JProgressBar();
progressBar.setBorder(new EmptyBorder(10, 10, 10, 10));
progressBar.setIndeterminate(true);
panel.add(progressBar, BorderLayout.CENTER);
return panel;
}
use of javax.swing.JProgressBar in project gate-core by GateNLP.
the class CorpusQualityAssurance method initGuiComponents.
protected void initGuiComponents() {
setLayout(new BorderLayout());
JPanel sidePanel = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
sidePanel.add(Box.createVerticalStrut(5), gbc);
// toolbar
JToolBar toolbar = new JToolBar();
toolbar.setFloatable(false);
toolbar.add(openDocumentAction = new OpenDocumentAction());
openDocumentAction.setEnabled(false);
toolbar.add(openAnnotationDiffAction = new OpenAnnotationDiffAction());
openAnnotationDiffAction.setEnabled(false);
toolbar.add(exportToHtmlAction = new ExportToHtmlAction());
toolbar.add(reloadCacheAction = new ReloadCacheAction());
toolbar.add(new HelpAction());
gbc.anchor = GridBagConstraints.NORTHWEST;
sidePanel.add(toolbar, gbc);
gbc.anchor = GridBagConstraints.NORTH;
sidePanel.add(Box.createVerticalStrut(5), gbc);
// annotation sets list
JLabel label = new JLabel("Annotation Sets A/Key & B/Response");
label.setToolTipText("aka 'Key & Response sets'");
gbc.fill = GridBagConstraints.BOTH;
sidePanel.add(label, gbc);
sidePanel.add(Box.createVerticalStrut(2), gbc);
setList = new JList();
setList.setSelectionModel(new ToggleSelectionABModel(setList));
setList.setPrototypeCellValue("present in every document");
setList.setVisibleRowCount(4);
gbc.weighty = 1;
sidePanel.add(new JScrollPane(setList), gbc);
gbc.weighty = 0;
sidePanel.add(Box.createVerticalStrut(2), gbc);
setCheck = new JCheckBox("present in every document", false);
setCheck.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
updateSetList();
}
});
sidePanel.add(setCheck, gbc);
sidePanel.add(Box.createVerticalStrut(5), gbc);
// annotation types list
label = new JLabel("Annotation Types");
label.setToolTipText("Annotation types to compare");
sidePanel.add(label, gbc);
sidePanel.add(Box.createVerticalStrut(2), gbc);
typeList = new JList();
typeList.setSelectionModel(new ToggleSelectionModel());
typeList.setPrototypeCellValue("present in every document");
typeList.setVisibleRowCount(4);
gbc.weighty = 1;
sidePanel.add(new JScrollPane(typeList), gbc);
gbc.weighty = 0;
sidePanel.add(Box.createVerticalStrut(2), gbc);
typeCheck = new JCheckBox("present in every selected set", false);
typeCheck.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
setList.getListSelectionListeners()[0].valueChanged(null);
}
});
sidePanel.add(typeCheck, gbc);
sidePanel.add(Box.createVerticalStrut(5), gbc);
// annotation features list
label = new JLabel("Annotation Features");
label.setToolTipText("Annotation features to compare");
sidePanel.add(label, gbc);
sidePanel.add(Box.createVerticalStrut(2), gbc);
featureList = new JList();
featureList.setSelectionModel(new ToggleSelectionModel());
featureList.setPrototypeCellValue("present in every document");
featureList.setVisibleRowCount(4);
gbc.weighty = 1;
sidePanel.add(new JScrollPane(featureList), gbc);
gbc.weighty = 0;
sidePanel.add(Box.createVerticalStrut(2), gbc);
featureCheck = new JCheckBox("present in every selected type", false);
featureCheck.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
typeList.getListSelectionListeners()[0].valueChanged(null);
}
});
sidePanel.add(featureCheck, gbc);
sidePanel.add(Box.createVerticalStrut(5), gbc);
// measures tabbed panes
label = new JLabel("Measures");
label.setToolTipText("Measures used to compare annotations");
optionsButton = new JToggleButton("Options");
optionsButton.setMargin(new Insets(1, 1, 1, 1));
JPanel labelButtonPanel = new JPanel(new BorderLayout());
labelButtonPanel.add(label, BorderLayout.WEST);
labelButtonPanel.add(optionsButton, BorderLayout.EAST);
sidePanel.add(labelButtonPanel, gbc);
sidePanel.add(Box.createVerticalStrut(2), gbc);
final JScrollPane measureScrollPane = new JScrollPane();
measureList = new JList();
measureList.setSelectionModel(new ToggleSelectionModel());
String prefix = getClass().getName() + '.';
double beta = (userConfig.getDouble(prefix + "fscorebeta") == null) ? 1.0 : userConfig.getDouble(prefix + "fscorebeta");
double beta2 = (userConfig.getDouble(prefix + "fscorebeta2") == null) ? 0.5 : userConfig.getDouble(prefix + "fscorebeta2");
String fscore = "F" + beta + "-score ";
String fscore2 = "F" + beta2 + "-score ";
measureList.setModel(new ExtendedListModel(new String[] { fscore + "strict", fscore + "lenient", fscore + "average", fscore + "strict BDM", fscore + "lenient BDM", fscore + "average BDM", fscore2 + "strict", fscore2 + "lenient", fscore2 + "average", fscore2 + "strict BDM", fscore2 + "lenient BDM", fscore2 + "average BDM" }));
measureList.setPrototypeCellValue("present in every document");
measureList.setVisibleRowCount(4);
measureScrollPane.setViewportView(measureList);
final JScrollPane measure2ScrollPane = new JScrollPane();
measure2List = new JList();
measure2List.setSelectionModel(new ToggleSelectionModel());
measure2List.setModel(new ExtendedListModel(new String[] { "Observed agreement", "Cohen's Kappa", "Pi's Kappa" }));
measure2List.setPrototypeCellValue("present in every document");
measure2List.setVisibleRowCount(4);
measure2ScrollPane.setViewportView(measure2List);
measureTabbedPane = new JTabbedPane();
measureTabbedPane.addTab("F-Score", null, measureScrollPane, "Inter-annotator agreement");
measureTabbedPane.addTab("Classification", null, measure2ScrollPane, "Classification agreement");
gbc.weighty = 1;
sidePanel.add(measureTabbedPane, gbc);
gbc.weighty = 0;
sidePanel.add(Box.createVerticalStrut(5), gbc);
sidePanel.add(Box.createVerticalGlue(), gbc);
// options panel for fscore measures
final JPanel measureOptionsPanel = new JPanel();
measureOptionsPanel.setLayout(new BoxLayout(measureOptionsPanel, BoxLayout.Y_AXIS));
JPanel betaPanel = new JPanel();
betaPanel.setLayout(new BoxLayout(betaPanel, BoxLayout.X_AXIS));
JLabel betaLabel = new JLabel("Fscore Beta 1:");
final JSpinner betaSpinner = new JSpinner(new SpinnerNumberModel(beta, 0, 1, 0.1));
betaSpinner.setToolTipText("<html>Relative weight of precision and recall." + "<ul><li>1 weights equally precision and recall" + "<li>0.5 weights precision twice as much as recall" + "<li>2 weights recall twice as much as precision</ul></html>");
betaPanel.add(betaLabel);
betaPanel.add(Box.createHorizontalStrut(5));
betaPanel.add(betaSpinner);
betaPanel.add(Box.createHorizontalGlue());
measureOptionsPanel.add(betaPanel);
betaSpinner.setMaximumSize(new Dimension(Integer.MAX_VALUE, Math.round(betaLabel.getPreferredSize().height * 1.5f)));
JPanel beta2Panel = new JPanel();
beta2Panel.setLayout(new BoxLayout(beta2Panel, BoxLayout.X_AXIS));
JLabel beta2Label = new JLabel("Fscore Beta 2:");
final JSpinner beta2Spinner = new JSpinner(new SpinnerNumberModel(beta2, 0, 1, 0.1));
beta2Spinner.setToolTipText(betaSpinner.getToolTipText());
beta2Panel.add(beta2Label);
beta2Panel.add(Box.createHorizontalStrut(5));
beta2Panel.add(beta2Spinner);
beta2Panel.add(Box.createHorizontalGlue());
measureOptionsPanel.add(beta2Panel);
beta2Spinner.setMaximumSize(new Dimension(Integer.MAX_VALUE, Math.round(beta2Label.getPreferredSize().height * 1.5f)));
JPanel bdmFilePanel = new JPanel();
bdmFilePanel.setLayout(new BoxLayout(bdmFilePanel, BoxLayout.X_AXIS));
JLabel bdmFileLabel = new JLabel("BDM file:");
JButton bdmFileButton = new JButton(new SetBdmFileAction());
bdmFilePanel.add(bdmFileLabel);
bdmFilePanel.add(Box.createHorizontalStrut(5));
bdmFilePanel.add(bdmFileButton);
bdmFilePanel.add(Box.createHorizontalGlue());
measureOptionsPanel.add(bdmFilePanel);
// options panel for classification measures
final JPanel measure2OptionsPanel = new JPanel();
measure2OptionsPanel.setLayout(new BoxLayout(measure2OptionsPanel, BoxLayout.Y_AXIS));
JPanel verbosePanel = new JPanel();
verbosePanel.setLayout(new BoxLayout(verbosePanel, BoxLayout.X_AXIS));
boolean verbose = (userConfig.getBoolean(prefix + "verbose") == null) ? false : userConfig.getBoolean(prefix + "verbose");
verboseOptionCheckBox = new JCheckBox("Output ignored annotations", verbose);
verbosePanel.add(verboseOptionCheckBox);
verbosePanel.add(Box.createHorizontalGlue());
measure2OptionsPanel.add(verbosePanel);
// options button action
optionsButton.setAction(new AbstractAction("Options") {
int[] selectedIndices;
@Override
public void actionPerformed(ActionEvent e) {
JToggleButton button = (JToggleButton) e.getSource();
// switch measure options panel and measure list
if (button.isSelected()) {
if (measuresType == FSCORE_MEASURES) {
selectedIndices = measureList.getSelectedIndices();
measureScrollPane.setViewportView(measureOptionsPanel);
} else if (measuresType == CLASSIFICATION_MEASURES) {
selectedIndices = measure2List.getSelectedIndices();
measure2ScrollPane.setViewportView(measure2OptionsPanel);
}
} else {
String prefix = getClass().getEnclosingClass().getName() + '.';
if (measuresType == FSCORE_MEASURES) {
// update beta with new values
String fscore = "F" + betaSpinner.getValue() + "-score ";
String fscore2 = "F" + beta2Spinner.getValue() + "-score ";
measureList.setModel(new ExtendedListModel(new String[] { fscore + "strict", fscore + "lenient", fscore + "average", fscore + "strict BDM", fscore + "lenient BDM", fscore + "average BDM", fscore2 + "strict", fscore2 + "lenient", fscore2 + "average", fscore2 + "strict BDM", fscore2 + "lenient BDM", fscore2 + "average BDM" }));
// save in GATE preferences
userConfig.put(prefix + "fscorebeta", betaSpinner.getValue());
userConfig.put(prefix + "fscorebeta2", beta2Spinner.getValue());
// put back the list and its selection
measureScrollPane.setViewportView(measureList);
measureList.setSelectedIndices(selectedIndices);
} else if (measuresType == CLASSIFICATION_MEASURES) {
userConfig.put(prefix + "verbose", verboseOptionCheckBox.isSelected());
measure2ScrollPane.setViewportView(measure2List);
measure2List.setSelectedIndices(selectedIndices);
}
}
}
});
// compare button and progress bar
JButton compareButton = new JButton(compareAction = new CompareAction());
compareAction.setEnabled(false);
sidePanel.add(compareButton, gbc);
sidePanel.add(Box.createVerticalStrut(5), gbc);
progressBar = new JProgressBar();
progressBar.setStringPainted(true);
progressBar.setString("");
sidePanel.add(progressBar, gbc);
sidePanel.add(Box.createVerticalStrut(5), gbc);
// tables
annotationTable = new XJTable() {
@Override
public boolean isCellEditable(int rowIndex, int vColIndex) {
return false;
}
@Override
protected JTableHeader createDefaultTableHeader() {
return new JTableHeader(columnModel) {
@Override
public String getToolTipText(MouseEvent event) {
int index = columnModel.getColumnIndexAtX(event.getPoint().x);
if (index == -1) {
return null;
}
int modelIndex = columnModel.getColumn(index).getModelIndex();
String columnName = this.table.getModel().getColumnName(modelIndex);
return createToolTipFromColumnName(columnName);
}
};
}
};
annotationTable.setModel(annotationTableModel);
annotationTable.setSortable(false);
annotationTable.setEnableHidingColumns(true);
annotationTable.setAutoResizeMode(XJTable.AUTO_RESIZE_ALL_COLUMNS);
documentTable = new XJTable() {
@Override
public boolean isCellEditable(int rowIndex, int vColIndex) {
return false;
}
@Override
protected JTableHeader createDefaultTableHeader() {
return new JTableHeader(columnModel) {
@Override
public String getToolTipText(MouseEvent event) {
int index = columnModel.getColumnIndexAtX(event.getPoint().x);
if (index == -1) {
return null;
}
int modelIndex = columnModel.getColumn(index).getModelIndex();
String columnName = this.table.getModel().getColumnName(modelIndex);
return createToolTipFromColumnName(columnName);
}
};
}
};
documentTable.setModel(documentTableModel);
documentTable.setSortable(false);
documentTable.setEnableHidingColumns(true);
documentTable.setAutoResizeMode(XJTable.AUTO_RESIZE_ALL_COLUMNS);
document2Table = new XJTable() {
@Override
public boolean isCellEditable(int rowIndex, int vColIndex) {
return false;
}
};
document2Table.setModel(document2TableModel);
confusionTable = new XJTable() {
@Override
public boolean isCellEditable(int rowIndex, int vColIndex) {
return false;
}
};
confusionTable.setModel(confusionTableModel);
confusionTable.setSortable(false);
tableTabbedPane = new JTabbedPane();
tableTabbedPane.addTab("Corpus statistics", null, new JScrollPane(annotationTable), "Compare each annotation type for the whole corpus");
tableTabbedPane.addTab("Document statistics", null, new JScrollPane(documentTable), "Compare each documents in the corpus with theirs annotations");
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
splitPane.setContinuousLayout(true);
splitPane.setOneTouchExpandable(true);
splitPane.setResizeWeight(0.80);
splitPane.setLeftComponent(tableTabbedPane);
splitPane.setRightComponent(new JScrollPane(sidePanel));
add(splitPane);
}
use of javax.swing.JProgressBar in project gate-core by GateNLP.
the class AnnotationDiffGUI method initGUI.
protected void initGUI() {
getContentPane().setLayout(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.anchor = GridBagConstraints.WEST;
constraints.insets = new Insets(2, 2, 2, 2);
constraints.weightx = 1;
/**
*****************************************
* First row - Settings and 'Compare' button *
******************************************
*/
constraints.gridy = 0;
JLabel keyDocLabel = new JLabel("Key doc:");
keyDocLabel.setToolTipText("Key document");
getContentPane().add(keyDocLabel, constraints);
keyDocCombo = new JComboBox<String>();
keyDocCombo.setPrototypeDisplayValue("long_document_name");
// add the value of the combobox in a tooltip for long value
keyDocCombo.setRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value != null) {
Rectangle textRectangle = new Rectangle(keyDocCombo.getSize().width, getPreferredSize().height);
String shortText = SwingUtilities.layoutCompoundLabel(this, getFontMetrics(getFont()), value.toString(), null, getVerticalAlignment(), getHorizontalAlignment(), getHorizontalTextPosition(), getVerticalTextPosition(), textRectangle, new Rectangle(), textRectangle, getIconTextGap());
if (shortText.equals(value)) {
// no tooltip
if (index == -1) {
keyDocCombo.setToolTipText(null);
} else {
setToolTipText(null);
}
} else {
// add tooltip because text is shortened
if (index == -1) {
keyDocCombo.setToolTipText(value.toString());
} else {
setToolTipText(value.toString());
}
}
}
return this;
}
});
constraints.weightx = 3;
getContentPane().add(keyDocCombo, constraints);
constraints.weightx = 1;
JLabel keySetLabel = new JLabel("Key set:");
keySetLabel.setToolTipText("Key annotation set");
getContentPane().add(keySetLabel, constraints);
keySetCombo = new JComboBox<String>();
keySetCombo.setPrototypeDisplayValue("long_set_name");
getContentPane().add(keySetCombo, constraints);
JLabel typeLabel = new JLabel("Type:");
typeLabel.setToolTipText("Annotation type");
getContentPane().add(typeLabel, constraints);
annTypeCombo = new JComboBox<String>();
annTypeCombo.setPrototypeDisplayValue("very_long_type");
constraints.gridwidth = 3;
getContentPane().add(annTypeCombo, constraints);
constraints.gridwidth = 1;
JLabel weightLabel = new JLabel("Weight");
weightLabel.setToolTipText("F-measure weight");
getContentPane().add(weightLabel, constraints);
diffAction = new DiffAction();
diffAction.setEnabled(false);
doDiffBtn = new JButton(diffAction);
doDiffBtn.setDisabledIcon(new RunIcon(MainFrame.ICON_DIMENSION, true));
doDiffBtn.setForeground((Color) UIManager.getDefaults().get("Button.disabledText"));
doDiffBtn.setToolTipText("Choose two annotation sets " + "that have at least one annotation type in common.");
constraints.gridheight = 2;
getContentPane().add(doDiffBtn, constraints);
constraints.gridheight = 1;
/**
***********************
* Second row - Settings *
************************
*/
constraints.gridy++;
constraints.gridx = 0;
JLabel responseDocLabel = new JLabel("Resp. doc:");
responseDocLabel.setToolTipText("Response document");
getContentPane().add(responseDocLabel, constraints);
constraints.gridx = GridBagConstraints.RELATIVE;
resDocCombo = new JComboBox<String>();
resDocCombo.setPrototypeDisplayValue("long_document_name");
resDocCombo.setRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value != null) {
Rectangle textRectangle = new Rectangle(resDocCombo.getSize().width, getPreferredSize().height);
String shortText = SwingUtilities.layoutCompoundLabel(this, getFontMetrics(getFont()), value.toString(), null, getVerticalAlignment(), getHorizontalAlignment(), getHorizontalTextPosition(), getVerticalTextPosition(), textRectangle, new Rectangle(), textRectangle, getIconTextGap());
if (shortText.equals(value)) {
// no tooltip
if (index == -1) {
resDocCombo.setToolTipText(null);
} else {
setToolTipText(null);
}
} else {
// add tooltip because text is shortened
if (index == -1) {
resDocCombo.setToolTipText(value.toString());
} else {
setToolTipText(value.toString());
}
}
}
return this;
}
});
constraints.weightx = 3;
getContentPane().add(resDocCombo, constraints);
constraints.weightx = 1;
JLabel responseSetLabel = new JLabel("Resp. set:");
responseSetLabel.setToolTipText("Response annotation set");
getContentPane().add(responseSetLabel, constraints);
resSetCombo = new JComboBox<String>();
resSetCombo.setPrototypeDisplayValue("long_set_name");
getContentPane().add(resSetCombo, constraints);
getContentPane().add(new JLabel("Features:"), constraints);
ButtonGroup btnGrp = new ButtonGroup();
allFeaturesBtn = new JRadioButton("all");
allFeaturesBtn.setOpaque(false);
allFeaturesBtn.setMargin(new Insets(0, 0, 0, 1));
allFeaturesBtn.setIconTextGap(1);
btnGrp.add(allFeaturesBtn);
constraints.insets = new Insets(0, 0, 0, 0);
getContentPane().add(allFeaturesBtn, constraints);
someFeaturesBtn = new JRadioButton("some");
someFeaturesBtn.setOpaque(false);
someFeaturesBtn.setMargin(new Insets(0, 0, 0, 1));
someFeaturesBtn.setIconTextGap(1);
btnGrp.add(someFeaturesBtn);
getContentPane().add(someFeaturesBtn, constraints);
noFeaturesBtn = new JRadioButton("none");
noFeaturesBtn.setOpaque(false);
noFeaturesBtn.setMargin(new Insets(0, 0, 0, 1));
noFeaturesBtn.setIconTextGap(1);
btnGrp.add(noFeaturesBtn);
getContentPane().add(noFeaturesBtn, constraints);
constraints.insets = new Insets(2, 2, 2, 2);
noFeaturesBtn.setSelected(true);
weightTxt = new JTextField("1.0");
weightTxt.setToolTipText("<html>Relative weight of precision and recall aka beta." + "<ul><li>1 weights equally precision and recall" + "<li>0.5 weights precision twice as much as recall" + "<li>2 weights recall twice as much as precision</ul></html>");
constraints.fill = GridBagConstraints.HORIZONTAL;
getContentPane().add(weightTxt, constraints);
constraints.fill = GridBagConstraints.NONE;
/**
******************************
* Third row - Comparison table *
*******************************
*/
constraints.gridy++;
constraints.gridx = 0;
diffTableModel = new DiffTableModel();
diffTable = new XJTable(diffTableModel);
diffTable.setDefaultRenderer(String.class, new DiffTableCellRenderer());
diffTable.setDefaultRenderer(Boolean.class, new DiffTableCellRenderer());
diffTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
diffTable.setComparator(DiffTableModel.COL_MATCH, new Comparator<String>() {
@Override
public int compare(String label1, String label2) {
int match1 = 0;
while (!label1.equals(matchLabel[match1])) match1++;
int match2 = 0;
while (!label2.equals(matchLabel[match2])) match2++;
return match1 - match2;
}
});
diffTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
diffTable.setRowSelectionAllowed(true);
diffTable.setColumnSelectionAllowed(true);
diffTable.setEnableHidingColumns(true);
diffTable.hideColumn(DiffTableModel.COL_KEY_COPY);
diffTable.hideColumn(DiffTableModel.COL_RES_COPY);
Comparator<String> startEndComparator = new Comparator<String>() {
@Override
public int compare(String no1, String no2) {
if (no1.trim().equals("") && no2.trim().equals("")) {
return 0;
} else if (no1.trim().equals("")) {
return -1;
} else if (no2.trim().equals("")) {
return 1;
}
int n1 = Integer.parseInt(no1);
int n2 = Integer.parseInt(no2);
if (n1 == n2)
return 0;
else if (n1 > n2)
return 1;
else
return -1;
}
};
diffTable.setComparator(DiffTableModel.COL_KEY_START, startEndComparator);
diffTable.setComparator(DiffTableModel.COL_KEY_END, startEndComparator);
diffTable.setComparator(DiffTableModel.COL_RES_START, startEndComparator);
diffTable.setComparator(DiffTableModel.COL_RES_END, startEndComparator);
diffTable.setSortable(true);
diffTable.setSortedColumn(DiffTableModel.COL_MATCH);
diffTable.setAscending(true);
scroller = new JScrollPane(diffTable);
constraints.gridwidth = GridBagConstraints.REMAINDER;
constraints.weightx = 1;
constraints.weighty = 1;
constraints.fill = GridBagConstraints.BOTH;
getContentPane().add(scroller, constraints);
constraints.gridwidth = 1;
constraints.weightx = 0;
constraints.weighty = 0;
constraints.fill = GridBagConstraints.NONE;
/**
***********************************************
* Fourth row - Tabbed panes, status and buttons *
************************************************
*/
bottomTabbedPane = new JTabbedPane(JTabbedPane.BOTTOM, JTabbedPane.WRAP_TAB_LAYOUT);
// statistics pane will be added to the bottom tabbed pane
statisticsPane = new JPanel(new GridBagLayout());
GridBagConstraints constraints2 = new GridBagConstraints();
constraints2.insets = new Insets(2, 2, 2, 2);
// first column
constraints2.gridx = 0;
constraints2.anchor = GridBagConstraints.WEST;
JLabel lbl = new JLabel("Correct:");
lbl.setToolTipText("Correct:");
lbl.setBackground(diffTable.getBackground());
statisticsPane.add(lbl, constraints2);
lbl = new JLabel("Partially correct:");
lbl.setToolTipText("Partially correct:");
lbl.setBackground(PARTIALLY_CORRECT_BG);
lbl.setOpaque(true);
statisticsPane.add(lbl, constraints2);
lbl = new JLabel("Missing:");
lbl.setToolTipText("Missing:");
lbl.setBackground(MISSING_BG);
lbl.setOpaque(true);
statisticsPane.add(lbl, constraints2);
lbl = new JLabel("False positives:");
lbl.setToolTipText("False positives:");
lbl.setBackground(FALSE_POSITIVE_BG);
lbl.setOpaque(true);
statisticsPane.add(lbl, constraints2);
// second column
constraints2.gridx++;
correctLbl = new JLabel("0");
statisticsPane.add(correctLbl, constraints2);
partiallyCorrectLbl = new JLabel("0");
statisticsPane.add(partiallyCorrectLbl, constraints2);
missingLbl = new JLabel("0");
statisticsPane.add(missingLbl, constraints2);
falsePozLbl = new JLabel("0");
statisticsPane.add(falsePozLbl, constraints2);
// third column
constraints2.gridx++;
constraints2.insets = new Insets(4, 30, 4, 4);
statisticsPane.add(Box.createGlue());
lbl = new JLabel("Strict:");
statisticsPane.add(lbl, constraints2);
lbl = new JLabel("Lenient:");
statisticsPane.add(lbl, constraints2);
lbl = new JLabel("Average:");
statisticsPane.add(lbl, constraints2);
// fourth column
constraints2.gridx++;
constraints2.insets = new Insets(4, 4, 4, 4);
lbl = new JLabel("Recall");
statisticsPane.add(lbl, constraints2);
recallStrictLbl = new JLabel("0.00");
statisticsPane.add(recallStrictLbl, constraints2);
recallLenientLbl = new JLabel("0.00");
statisticsPane.add(recallLenientLbl, constraints2);
recallAveLbl = new JLabel("0.00");
statisticsPane.add(recallAveLbl, constraints2);
// fifth column
constraints2.gridx++;
lbl = new JLabel("Precision");
statisticsPane.add(lbl, constraints2);
precisionStrictLbl = new JLabel("0.00");
statisticsPane.add(precisionStrictLbl, constraints2);
precisionLenientLbl = new JLabel("0.00");
statisticsPane.add(precisionLenientLbl, constraints2);
precisionAveLbl = new JLabel("0.00");
statisticsPane.add(precisionAveLbl, constraints2);
// sixth column
constraints2.gridx++;
lbl = new JLabel("F-measure");
lbl.setToolTipText("<html>F-measure =<br>" + " ((weight² + 1) * precision * recall)<br>" + " / (weight² * precision + recall))</html>");
statisticsPane.add(lbl, constraints2);
fmeasureStrictLbl = new JLabel("0.00");
statisticsPane.add(fmeasureStrictLbl, constraints2);
fmeasureLenientLbl = new JLabel("0.00");
statisticsPane.add(fmeasureLenientLbl, constraints2);
fmeasureAveLbl = new JLabel("0.00");
statisticsPane.add(fmeasureAveLbl, constraints2);
bottomTabbedPane.add("Statistics", statisticsPane);
// adjudication pane will be added to the bottom tabbed pane
JPanel adjudicationPane = new JPanel(new GridBagLayout());
constraints2 = new GridBagConstraints();
constraints2.insets = new Insets(2, 2, 2, 2);
// first row
constraints2.gridy = 0;
adjudicationPane.add(new JLabel("Target set:"), constraints2);
consensusASTextField = new JTextField("consensus", 15);
consensusASTextField.setToolTipText("Annotation set name where to copy the selected annotations");
adjudicationPane.add(consensusASTextField, constraints2);
// second row
constraints2.gridy++;
constraints2.gridx = 0;
copyToTargetSetAction = new CopyToTargetSetAction();
copyToTargetSetAction.setEnabled(false);
copyToConsensusBtn = new JButton(copyToTargetSetAction);
copyToConsensusBtn.setDisabledIcon(new RightArrowIcon(MainFrame.ICON_DIMENSION, true));
constraints2.gridwidth = 2;
adjudicationPane.add(copyToConsensusBtn, constraints2);
bottomTabbedPane.add("Adjudication", adjudicationPane);
JPanel bottomPanel = new JPanel(new GridBagLayout());
constraints2 = new GridBagConstraints();
constraints2.insets = new Insets(2, 2, 2, 2);
// add the bottom tabbed pane to the bottom panel
constraints2.gridx = 0;
constraints2.gridy = 0;
constraints2.gridheight = 3;
constraints2.anchor = GridBagConstraints.WEST;
bottomPanel.add(bottomTabbedPane, constraints2);
constraints2.gridheight = 1;
// status bar
constraints2.gridx++;
statusLabel = new JLabel();
statusLabel.setBackground(diffTable.getBackground());
constraints2.insets = new Insets(2, 6, 6, 2);
bottomPanel.add(statusLabel, constraints2);
// toolbar
JToolBar toolbar = new JToolBar();
toolbar.setFloatable(false);
if (!isStandalone) {
showDocumentAction = new ShowDocumentAction();
showDocumentAction.setEnabled(false);
showDocumentBtn = new JButton(showDocumentAction);
showDocumentBtn.setDisabledIcon(new DocumentIcon(MainFrame.ICON_DIMENSION, true));
showDocumentBtn.setToolTipText("Use first the \"Compare\"" + " button then select an annotation in the table.");
toolbar.add(showDocumentBtn);
}
htmlExportAction = new HTMLExportAction();
htmlExportAction.setEnabled(false);
htmlExportBtn = new JButton(htmlExportAction);
htmlExportBtn.setDisabledIcon(new DownIcon(MainFrame.ICON_DIMENSION, true));
htmlExportBtn.setToolTipText("Use first the \"Compare\" button.");
toolbar.add(htmlExportBtn);
if (!isStandalone) {
toolbar.add(new HelpAction());
}
constraints2.gridy++;
constraints2.fill = GridBagConstraints.NONE;
constraints2.anchor = GridBagConstraints.NORTHWEST;
bottomPanel.add(toolbar, constraints2);
// progress bar
progressBar = new JProgressBar();
progressBar.setMinimumSize(new Dimension(5, 5));
progressBar.setBackground(diffTable.getBackground());
progressBar.setOpaque(true);
constraints2.gridy++;
constraints2.anchor = GridBagConstraints.SOUTHWEST;
bottomPanel.add(progressBar, constraints2);
// add the bottom panel to the fourth row
constraints.gridy++;
constraints.gridx = 0;
constraints.gridwidth = GridBagConstraints.REMAINDER;
constraints.gridheight = GridBagConstraints.REMAINDER;
constraints.anchor = GridBagConstraints.WEST;
constraints.insets = new Insets(0, 0, 0, 0);
getContentPane().add(bottomPanel, constraints);
constraints.insets = new Insets(2, 2, 2, 2);
// set the background colour
Color background = diffTable.getBackground();
getContentPane().setBackground(background);
scroller.setBackground(background);
scroller.getViewport().setBackground(background);
statisticsPane.setBackground(background);
adjudicationPane.setBackground(background);
bottomPanel.setBackground(background);
bottomTabbedPane.setBackground(background);
featureslistModel = new DefaultListModel<String>();
featuresList = new JList<String>(featureslistModel);
featuresList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
keySetCombo.requestFocusInWindow();
}
use of javax.swing.JProgressBar 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();
}
Aggregations