static { OPTION_TYPES .put(DEFAULT_OPTION, "DEFAULT_OPTION") .put(YES_NO_OPTION, "YES_NO_OPTION") .put(YES_NO_CANCEL_OPTION, "YES_NO_CANCEL_OPTION") .put(QUESTION_MESSAGE, "QUESTION_MESSAGE") .put(OK_CANCEL_OPTION, "OK_CANCEL_OPTION"); }
static { MESSAGE_TYPES .put(ERROR_MESSAGE, "ERROR_MESSAGE") .put(INFORMATION_MESSAGE, "INFORMATION_MESSAGE") .put(WARNING_MESSAGE, "WARNING_MESSAGE") .put(QUESTION_MESSAGE, "QUESTION_MESSAGE") .put(PLAIN_MESSAGE, "PLAIN_MESSAGE"); }
/** * Returns the <code>String</code> representation of the given <code>{@link Component}</code>, * which should be a <code>{@link JOptionPane}</code> (or subclass.) * * @param c the given <code>Component</code>. * @return the <code>String</code> representation of the given <code>JOptionPane</code>. */ protected String doFormat(Component c) { JOptionPane optionPane = (JOptionPane) c; return concat( optionPane.getClass().getName(), "[", "message=", quote(optionPane.getMessage()), ", ", "messageType=", MESSAGE_TYPES.get(optionPane.getMessageType()), ", ", "optionType=", OPTION_TYPES.get(optionPane.getOptionType()), ", ", "enabled=", valueOf(optionPane.isEnabled()), ", ", "visible=", valueOf(optionPane.isVisible()), ", ", "showing=", valueOf(optionPane.isShowing()), "]"); }
private @Nullable String selectionMode(JTree tree) { TreeSelectionModel model = tree.getSelectionModel(); return SELECTION_MODES.get(model.getSelectionMode()); }
static { SELECTION_MODES .put(SINGLE_TREE_SELECTION, "SINGLE_TREE_SELECTION") .put(CONTIGUOUS_TREE_SELECTION, "CONTIGUOUS_TREE_SELECTION") .put(DISCONTIGUOUS_TREE_SELECTION, "DISCONTIGUOUS_TREE_SELECTION"); }