javax.swing.plaf.basic.BasicTextFieldUI Java Examples
The following examples show how to use
javax.swing.plaf.basic.BasicTextFieldUI.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PageField.java From gcs with Mozilla Public License 2.0 | 5 votes |
/** * Creates a new text input field. * * @param sheet The sheet to listen to. * @param consumedType The field to listen to. * @param alignment The alignment of the field. * @param editable Whether or not the user can edit this field. * @param tooltip The tooltip to set. */ public PageField(CharacterSheet sheet, String consumedType, int alignment, boolean editable, String tooltip) { super(getFormatterFactoryForType(sheet.getCharacter(), consumedType), sheet.getCharacter().getValueForID(consumedType)); if (Platform.isLinux()) { // I override the UI here since the GTK UI on Linux has no way to turn off the border // around text fields. setUI(new BasicTextFieldUI()); } mSheet = sheet; mConsumedType = consumedType; setFont(sheet.getScale().scale(UIManager.getFont(Fonts.KEY_FIELD_PRIMARY))); setBorder(null); setOpaque(false); // Just setting opaque to false isn't enough for some reason, so I'm also setting the // background color to a 100% transparent value. setBackground(new Color(255, 255, 255, 0)); setHorizontalAlignment(alignment); setEditable(editable); setEnabled(editable); if (editable) { setForeground(new Color(0, 0, 192)); } else { setDisabledTextColor(Color.BLACK); } setToolTipText(Text.wrapPlainTextForToolTip(tooltip)); mSheet.getCharacter().addTarget(this, mConsumedType); addPropertyChangeListener("value", this); addActionListener(this); setFocusLostBehavior(COMMIT_OR_REVERT); }