Package org.basex.gui.layout
Class BaseXLayout
java.lang.Object
org.basex.gui.layout.BaseXLayout
This class provides static layout and paint helper methods which are used all over
the GUI.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddDrop(JComponent comp, BaseXLayout.DropHandler dnd) Adds drag and drop functionality.static voidaddInteraction(Component comp, BaseXWindow win) Adds default listeners to the specified component.static StringaddShortcut(String string, String sc) Adds human readable shortcuts to the specified string.static Graphics2DActivates graphics anti-aliasing.static voidboldFont(JComponent comp) Uses a bold font for the specified component.static EmptyBorderborder(int t, int l, int b, int r) Returns a border with the specified insets.static voidchopString(Graphics g, byte[] string, int x, int y, int w, int fs) Draws the specified string and chops the last characters if there is not enough space.contents(Transferable tr) Returns the contents of the specified transferable.static voidCopies the specified string to the clipboard.static voidCopies the specified file path to the clipboard.static voidDraws a colored cell.static voiddrawCenter(Graphics g, String string, int w, int y) Draws a centered string to the panel.static voiddrawTooltip(Graphics g, String tt, int x, int y, int w, int c) Draws a visualization tooltip.static voidSet desktop hints (not supported by all platforms).static KeyStrokekeyStroke(GUICommand cmd) Returns a keystroke for the specified string.static voidresizeFont(JComponent comp, float factor) Resizes a font.static voidSets the scaled component height, adopting the original component width.static voidsetMnemonic(AbstractButton b, StringBuilder mnem) Sets a mnemomic for the specified button.static voidSets the scaled component width, adopting the original component height.static Stringvalue(double val) Returns the value of the specified pre value and attribute.static intReturns the width of the specified string.static intReturns the character width of the specified character.static intReturns the width of the specified text.
-
Method Details
-
hints
Set desktop hints (not supported by all platforms).- Parameters:
g- graphics reference
-
antiAlias
Activates graphics anti-aliasing.- Parameters:
g- graphics reference- Returns:
- graphics reference
-
setWidth
Sets the scaled component width, adopting the original component height.- Parameters:
comp- componentw- width
-
setHeight
Sets the scaled component height, adopting the original component width.- Parameters:
comp- componenth- height
-
border
Returns a border with the specified insets.- Parameters:
t- top distancel- left distanceb- bottom distancer- right distance- Returns:
- border
-
addDrop
Adds drag and drop functionality.- Parameters:
comp- componentdnd- drag and drop handler
-
keyStroke
Returns a keystroke for the specified string.- Parameters:
cmd- command- Returns:
- keystroke or
null
-
setMnemonic
Sets a mnemomic for the specified button.- Parameters:
b- buttonmnem- mnemonics that have already been assigned
-
contents
Returns the contents of the specified transferable.- Parameters:
tr- transferable- Returns:
- contents
-
copy
Copies the specified string to the clipboard.- Parameters:
text- text
-
copyPath
Copies the specified file path to the clipboard.- Parameters:
path- path
-
addInteraction
Adds default listeners to the specified component.- Parameters:
comp- componentwin- parent window
-
addShortcut
Adds human readable shortcuts to the specified string.- Parameters:
string- tooltip stringsc- shortcut- Returns:
- tooltip
-
value
Returns the value of the specified pre value and attribute.- Parameters:
val- value to be evaluated- Returns:
- value as string
-
drawCell
Draws a colored cell.- Parameters:
g- graphics referencexs- horizontal start positionxe- horizontal end positionys- vertical start positionye- vertical end positionfocus- highlighting flag
-
drawCenter
Draws a centered string to the panel.- Parameters:
g- graphics referencestring- string to be drawnw- panel widthy- vertical position
-
drawTooltip
Draws a visualization tooltip.- Parameters:
g- graphics referencett- tooltip labelx- horizontal positiony- vertical positionw- widthc- color color depth
-
width
Returns the width of the specified text.- Parameters:
g- graphics references- string to be evaluated- Returns:
- string width
-
chopString
Draws the specified string and chops the last characters if there is not enough space.- Parameters:
g- graphics referencestring- stringx- x coordinatey- y coordinatew- widthfs- font size
-
width
Returns the width of the specified string. Cached font widths are used to speed up calculation.- Parameters:
g- graphics referencestring- string- Returns:
- string width
-
width
Returns the character width of the specified character.- Parameters:
g- graphics referencecp- code point- Returns:
- character width
-
resizeFont
Resizes a font.- Parameters:
comp- componentfactor- resize factor
-
boldFont
Uses a bold font for the specified component.- Parameters:
comp- component
-