📄 uioptionpanel.java
字号:
* whenever the user clicks "OK" or "Apply" on the options dialog to
* ensure all input is valid. If it isn't, the component with invalid
* data will be given focus and the user will be prompted to fix it.<br>
*
*
* @return <code>null</code> if the panel has all valid inputs, or an
* <code>OptionsPanelCheckResult</code> if an input was invalid.
* This component is the one that had the error and will be
* given focus, and the string is an error message that will be
* displayed.
*/
public OptionsPanelCheckResult ensureValidInputs() {
// They can't input invalid stuff on this options panel.
return null;
}
/*****************************************************************************/
/**
* Returns the document selection placement the user chose.
*
* @return The document selection placement.
* @see #setDocumentSelectionPlacement
*/
public int getDocumentSelectionPlacement() {
return documentSelectionPlacement;
}
/*****************************************************************************/
/**
* Returns the icon style the user chose.
*
* @return The icon style.
* @see #setIconGroupByName
*/
public String getIconGroupName() {
return imageLnFCombo.getSelectedSpecialItem();
}
/*****************************************************************************/
/**
* Returns the selected Look and Feel.
*
* @return The look and feel.
* @see #setLookAndFeelByClassName
*/
public String getLookAndFeelClassName() {
return lnfCombo.getSelectedSpecialItem();
}
/*****************************************************************************/
/**
* Returns the main view style the user chose.
*
* @return The main view style, either <code>RText.TABBED_VIEW</code> or
* <code>RText.SPLIT_PANE_VIEW</code>.
* @see #setMainViewStyle
*/
public int getMainViewStyle() {
return mainViewStyle;
}
/*****************************************************************************/
/**
* Gets the color the user chose to highlight modified documents'
* display names.
*
* @return color The color chosen.
* @see #setModifiedDocumentDisplayNamesColor
* @see #highlightModifiedDocumentDisplayNames
* @see #setHighlightModifiedDocumentDisplayNames
*/
public Color getModifiedDocumentDisplayNamesColor() {
return hmColorButton.getColor();
}
/*****************************************************************************/
/**
* Returns the status bar style selected by the user.
*
* @return The status bar style selected.
* @see #setStatusBarStyle
*/
public int getStatusBarStyle() {
return statusBarStyle;
}
/*****************************************************************************/
/**
* Returns the <code>JComponent</code> at the "top" of this Options
* panel. This is the component that will receive focus if the user
* switches to this Options panel in the Options dialog. As an added
* bonus, if this component is a <code>JTextComponent</code>, its
* text is selected for easy changing.
*/
public JComponent getTopJComponent() {
return viewCombo;
}
/*****************************************************************************/
/**
* Returns whether the user chose to highlight documents' display names
* with a different color.
*
* @return Whether or not the user chose to highlight documents' display
* names with a different color.
*
* @see #setHighlightModifiedDocumentDisplayNames
* @see #getModifiedDocumentDisplayNamesColor
* @see #setModifiedDocumentDisplayNamesColor
*/
public boolean highlightModifiedDocumentDisplayNames() {
return highlightModifiedCheckBox.isSelected();
}
/*****************************************************************************/
/**
* Called whenever a property change occurs in this panel.
*/
public void propertyChange(PropertyChangeEvent e) {
String propertyName = e.getPropertyName();
if (propertyName.equals(RColorSwatchesButton.COLOR_CHANGED_PROPERTY)) {
hasUnsavedChanges = true;
firePropertyChange("UIOptionPanel." + propertyName,
e.getOldValue(), e.getNewValue());
}
}
/*****************************************************************************/
/**
* Sets the tab placement displayed by this panel.
*
* @param documentSelectionPlacement The tab placement displayed; one of
* <code>JTabbedPane.LEFT</code>, <code>TOP</code>,
* <code>RIGHT</code>, or <code>BOTTOM</code>.
* @see #getDocumentSelectionPlacement
*/
public void setDocumentSelectionPlacement(int documentSelectionPlacement) {
if (documentSelectionPlacement!=JTabbedPane.LEFT &&
documentSelectionPlacement!=JTabbedPane.RIGHT &&
documentSelectionPlacement!=JTabbedPane.TOP &&
documentSelectionPlacement!=JTabbedPane.BOTTOM) {
documentSelectionPlacement = JTabbedPane.TOP;
}
if (this.documentSelectionPlacement!=documentSelectionPlacement) {
this.documentSelectionPlacement = documentSelectionPlacement;
docSelCombo.setSelectedIndex(documentSelectionPlacement -
JTabbedPane.TOP);
}
}
/*****************************************************************************/
/**
* Sets whether the "highlight modified documents' display names"
* checkbox is checked.
*
* @param highlight Whether or not the checkbox is to be checked.
* @see #highlightModifiedDocumentDisplayNames
* @see #getModifiedDocumentDisplayNamesColor
* @see #setModifiedDocumentDisplayNamesColor
*/
public void setHighlightModifiedDocumentDisplayNames(boolean highlight) {
highlightModifiedCheckBox.setSelected(highlight);
hmColorButton.setEnabled(highlight);
}
/*****************************************************************************/
/**
* Sets the icon style displayed by this panel.
*
* @param name The name of the icon group.
* @see #getIconGroupName
*/
public void setIconGroupByName(String name) {
int count = imageLnFCombo.getItemCount();
for (int i=0; i<count; i++) {
String specialValue = imageLnFCombo.getSpecialItemAt(i);
if (specialValue.equals(name)) {
imageLnFCombo.setSelectedIndex(i);
return;
}
}
imageLnFCombo.setSelectedIndex(0); // Default value???
}
/*****************************************************************************/
/**
* Sets the look and feel displayed in this panel.
*
* @param name The class name for the Look.
* @see #getLookAndFeelClassName
*/
public void setLookAndFeelByClassName(String name) {
int count = lnfCombo.getItemCount();
for (int i=0; i<count; i++) {
String specialValue = lnfCombo.getSpecialItemAt(i);
if (specialValue.equals(name)) {
lnfCombo.setSelectedIndex(i);
return;
}
}
lnfCombo.setSelectedIndex(0); // Default value???
}
/*****************************************************************************/
/**
* Sets the main view style displayed by this panel.
*
* @param viewStyle The style displayed; either
* <code>RText.TABBED_VIEW</code> or
* <code>RText.SPLIT_PANE_VIEW</code>.
* @see #getMainViewStyle
*/
public void setMainViewStyle(final int viewStyle) {
if (viewStyle==RText.TABBED_VIEW || viewStyle==RText.SPLIT_PANE_VIEW ||
viewStyle==RText.MDI_VIEW)
mainViewStyle = viewStyle;
else
mainViewStyle = RText.TABBED_VIEW;
viewCombo.setSelectedIndex(mainViewStyle);
}
/*****************************************************************************/
/**
* Sets the color for the button used for selecting the color used
* to highlight modified documents' display names.
*
* @param color The color to use.
* @throws NullPointerException If <code>color</code> is <code>null</code>.
* @see #getModifiedDocumentDisplayNamesColor
* @see #highlightModifiedDocumentDisplayNames
* @see #setHighlightModifiedDocumentDisplayNames
*/
public void setModifiedDocumentDisplayNamesColor(Color color) {
if (color==null)
throw new NullPointerException();
hmColorButton.setColor(color);
}
/*****************************************************************************/
/**
* Sets the status bar style selected.
*
* @param style The status bar style.
* @see #getStatusBarStyle
*/
public void setStatusBarStyle(int style) {
if (style!=StatusBar.WINDOWS_98_STYLE &&
style!=StatusBar.WINDOWS_XP_STYLE)
style = StatusBar.WINDOWS_XP_STYLE;
statusBarStyle = style;
statusBarCombo.setSelectedIndex(statusBarStyle);
}
/*****************************************************************************/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -