JPanel treePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
treePanel.setOpaque(false);
- treePanel.setBorder(BorderFactory
- .createTitledBorder(MessageManager.getString("label.tree")));
+ JvSwingUtils.createItalicTitledBorder(treePanel,
+ MessageManager.getString("label.tree"), true);
// then copy the inset dimensions for the border-less PCA panel
JPanel pcaBorderless = new JPanel(new FlowLayout(FlowLayout.LEFT));
}
}
+ threshline = new GraphLine((max - min) / 2f, "Threshold", Color.black);
+ threshline.value = cs.getThreshold();
+
if (cs.hasThreshold())
{
// initialise threshold slider and selector
slider.setEnabled(true);
slider.setValue((int) (cs.getThreshold() * scaleFactor));
thresholdValue.setEnabled(true);
- threshline = new GraphLine((max - min) / 2f, "Threshold",
- Color.black);
- threshline.value = cs.getThreshold();
}
adjusting = false;
{
JPanel byValuePanel = new JPanel();
byValuePanel.setLayout(new BoxLayout(byValuePanel, BoxLayout.Y_AXIS));
- byValuePanel.setBorder(BorderFactory.createTitledBorder(MessageManager
- .getString("label.colour_by_value")));
+ JvSwingUtils.createItalicTitledBorder(byValuePanel,
+ MessageManager.getString("label.colour_by_value"), true);
byValuePanel.setBackground(Color.white);
/*
{
JPanel byTextPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
byTextPanel.setBackground(Color.white);
- byTextPanel.setBorder(BorderFactory.createTitledBorder(MessageManager
- .getString("label.colour_by_text")));
+ JvSwingUtils.createItalicTitledBorder(byTextPanel,
+ MessageManager.getString("label.colour_by_text"), true);
byDescription.setText(MessageManager.getString("label.label"));
byDescription.setToolTipText(MessageManager
*/
JPanel chooseTypePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
chooseTypePanel.setBackground(Color.white);
- chooseTypePanel.setBorder(BorderFactory
- .createTitledBorder(MessageManager
- .getString("label.feature_type")));
+ JvSwingUtils.createItalicTitledBorder(chooseTypePanel,
+ MessageManager.getString("label.feature_type"), true);
filteredFeatureChoice = new JComboBox<>();
filteredFeatureChoice.addItemListener(new ItemListener()
{
JPanel filtersPanel = new JPanel();
filtersPanel.setLayout(new BoxLayout(filtersPanel, BoxLayout.Y_AXIS));
filtersPanel.setBackground(Color.white);
- filtersPanel.setBorder(BorderFactory
- .createTitledBorder(MessageManager.getString("label.filters")));
+ JvSwingUtils.createItalicTitledBorder(filtersPanel,
+ MessageManager.getString("label.filters"), true);
/*
* add AND or OR radio buttons
*/
JPanel showFiltersPanel = new JPanel(new BorderLayout(5, 5));
showFiltersPanel.setBackground(Color.white);
- showFiltersPanel.setBorder(BorderFactory
- .createTitledBorder(MessageManager
- .getString("label.match_condition")));
+ JvSwingUtils.createItalicTitledBorder(showFiltersPanel,
+ MessageManager.getString("label.match_condition"), true);
filtersAsText = new JTextArea();
filtersAsText.setLineWrap(true);
filtersAsText.setWrapStyleWord(true);
import java.util.Objects;
import javax.swing.AbstractButton;
+import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JScrollBar;
import javax.swing.SwingConstants;
+import javax.swing.border.Border;
+import javax.swing.border.TitledBorder;
/**
* useful functions for building Swing GUIs
return combo;
}
+ /**
+ * Adds a titled border to the component in the default font and position (top
+ * left)
+ *
+ * @param comp
+ * @param title
+ */
+ public static void createItalicTitledBorder(JComponent comp,
+ String title, boolean italic)
+ {
+ Font font = comp.getFont();
+ if (italic)
+ {
+ font = new Font(font.getName(), Font.ITALIC, font.getSize());
+ }
+ Border border = BorderFactory.createTitledBorder("");
+ TitledBorder titledBorder = BorderFactory.createTitledBorder(border,
+ title, TitledBorder.LEADING, TitledBorder.DEFAULT_POSITION,
+ font);
+ comp.setBorder(titledBorder);
+ }
+
}