本文整理汇总了Java中goryachev.fx.FX类的典型用法代码示例。如果您正苦于以下问题:Java FX类的具体用法?Java FX怎么用?Java FX使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FX类属于goryachev.fx包,在下文中一共展示了FX类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDividerBar
import goryachev.fx.FX; //导入依赖的package包/类
protected Region getDividerBar(int ix)
{
while(dividerBars.size() <= ix)
{
Region r = new Region();
r.setBackground(FX.background(Color.BLACK));
FX.style(this, DIVIDER);
r.setManaged(false);
getChildren().add(r);
r.applyCss();
dividerBars.add(r);
}
return dividerBars.get(ix);
}
示例2: toText
import goryachev.fx.FX; //导入依赖的package包/类
protected Text toText(LineSegment seg)
{
Text t = new Text(seg.text);
switch(seg.type)
{
case BYTES:
t.setFill(Color.DARKGREEN);
break;
case ERROR:
t.setFill(Color.MAGENTA);
break;
case HEADING:
t.setFill(Color.BLACK);
FX.style(t, HEADING);
break;
case TEXT:
default:
t.setFill(Color.BLACK);
break;
}
return t;
}
示例3: createMenu
import goryachev.fx.FX; //导入依赖的package包/类
protected CMenuBar createMenu()
{
CMenuBar b = new CMenuBar();
// app
CMenu m = b.addMenu("FxDemo");
m.add("Preferences", prefsAction);
m.separator();
m.add("Exit", FX.exitAction());
// tools
m = b.addMenu("Tools");
m.add("Reload", pane.reloadAction);
// help
m = b.addMenu("Help");
m.add("About");
return b;
}
示例4: StyledTextPane
import goryachev.fx.FX; //导入依赖的package包/类
public StyledTextPane()
{
textField = new CTextFlow();
caret = new Path();
FX.style(caret, CARET);
caret.setManaged(false);
caret.setStroke(Color.BLACK);
getChildren().add(textField);
caretTimeline = new Timeline();
caretTimeline.setCycleCount(Animation.INDEFINITE);
// TODO property
updateBlinkRate(Duration.millis(500));
// FIX allow custom handlers
new StyledTextPaneMouseController(this);
}
示例5: restoreSplitPane
import goryachev.fx.FX; //导入依赖的package包/类
private static void restoreSplitPane(String prefix, SplitPane sp)
{
String k = prefix + SFX_DIVIDERS;
SStream s = GlobalSettings.getStream(k);
// must run later because of FX split pane inability to set divider positions exactly
FX.later(() ->
{
int ct = s.nextInt();
if(sp.getDividers().size() == ct)
{
for(int i=0; i<ct; i++)
{
double div = s.nextDouble();
sp.setDividerPosition(i, div);
}
}
});
}
示例6: openFilePrivate
import goryachev.fx.FX; //导入依赖的package包/类
protected void openFilePrivate()
{
try
{
delegateCommit();
if(checkModified())
{
FileChooser fc = fileChooser();
File f = fc.showOpenDialog(parent);
if(f != null)
{
File dir = f.getParentFile();
lastFolder.set(dir);
openFilePrivate(f);
FX.storeSettings();
}
}
}
catch(Exception e)
{
Dialogs.error(parent, e);
}
}
示例7: TreeTablePane
import goryachev.fx.FX; //导入依赖的package包/类
public TreeTablePane()
{
tree = new TreeTableView<>();
tree.setShowRoot(false);
tree.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
tree.setEditable(true);
tree.setColumnResizePolicy(TreeTableView.CONSTRAINED_RESIZE_POLICY);
FX.style(tree, CssTools.NO_HORIZONTAL_SCROLL_BAR, TREE);
handler = new TreeTableHandler<Page>(tree);
setupActions();
addColumn(Page.Field.TITLE, "Title");
addColumn(Page.Field.TIME_CREATED, "Created");
addColumn(Page.Field.STATUS, "Status");
setCenter(tree);
}
示例8: addColumn
import goryachev.fx.FX; //导入依赖的package包/类
protected void addColumn(Page.Field f, String label)
{
FxTreeTableColumn<Page> tc = new FxTreeTableColumn<Page>(label, true)
{
protected ObservableValue getCellValueProperty(Page p)
{
return FX.toObservableValue(p.getField(f));
}
};
tc.setAlignment(getAlignment(f));
tc.setConverter(getFormatter(f));
tc.setPrefWidth(getPreferredWidth(f));
tc.setEditable(isColumnEditable(f));
tc.setSortable(false);
tc.setCellFactory(createCellFactory(tc, f));
tree.getColumns().add(tc);
}
示例9: edit
import goryachev.fx.FX; //导入依赖的package包/类
public void edit(TreeItem<Page> p)
{
tree.getSelectionModel().select(p);
int ix = tree.getSelectionModel().getSelectedIndex();
tree.getSelectionModel().clearAndSelect(ix);
if(ix < 0)
{
return;
}
FX.later(() ->
{
tree.edit(ix, tree.getColumns().get(0));
Node n = tree.lookup(".text-input");
// FIX focus the editor
FX.later(() ->
{
// it looks like the editor is losing focus
n.requestFocus();
});
});
}
示例10: createToolBar
import goryachev.fx.FX; //导入依赖的package包/类
protected Node createToolBar(boolean tabMode)
{
HPane t = new HPane(5);
t.setMaxWidth(Double.MAX_VALUE);
t.setPadding(new Insets(2, 2, 2, 2));
if(!tabMode)
{
Button b = new Button("x");
FX.style(b, FxDockStyles.TOOLBAR_CLOSE_BUTTON);
closeAction.attach(b);
t.add(titleField);
t.add(b);
}
t.fill(addressField);
t.add(new CButton("Reload", reloadAction));
return t;
}
示例11: a
import goryachev.fx.FX; //导入依赖的package包/类
private static void a(Pane p, int gap, double ... specs)
{
HPane hp = new HPane(2);
int ix = 0;
for(double w: specs)
{
Color c = Color.gray(0.5 + 0.5 * ix / (specs.length - 1));
String text = DemoTools.spec(w);
TextField t = new TextField(text);
t.setEditable(false);
t.setPrefColumnCount(3);
t.setBackground(FX.background(c));
t.setPadding(Insets.EMPTY);
hp.add(t, w);
ix++;
}
p.getChildren().add(hp);
}
示例12: createToolBar
import goryachev.fx.FX; //导入依赖的package包/类
/** override to create your own toolbar, possibly with custom icons and buttons */
protected Node createToolBar(boolean tabMode)
{
if(tabMode)
{
return null;
}
else
{
Button b = new Button("x");
FX.style(b, FxDockStyles.TOOLBAR_CLOSE_BUTTON);
closeAction.attach(b);
ToolBar t = new ToolBar();
FX.style(t, FxDockStyles.TOOLBAR);
t.getItems().addAll(titleField, b);
return t;
}
}
示例13: computePrefWidth
import goryachev.fx.FX; //导入依赖的package包/类
@Override
protected double computePrefWidth(double height)
{
// return Double.MAX_VALUE;
// return super.computePrefWidth(height);
FxSize d = FX.getTextBounds(this, -1);
Insets insets = getInsets();
double w = Math.ceil(d.getWidth() + insets.getLeft() + insets.getRight());
return w;
}
示例14: computePrefHeight
import goryachev.fx.FX; //导入依赖的package包/类
@Override
protected double computePrefHeight(double width)
{
// return super.computePrefHeight(width);
FxSize d = FX.getTextBounds(this, width);
return d.getHeight();
}
示例15: CSplitPane
import goryachev.fx.FX; //导入依赖的package包/类
public CSplitPane(boolean horizontal)
{
this.horizontal = horizontal;
FX.style(this, PANE);
addEventFilter(MouseEvent.MOUSE_ENTERED, (ev) -> handleMouseEntered(ev));
addEventFilter(MouseEvent.MOUSE_MOVED, (ev) -> handleMouseMoved(ev));
addEventFilter(MouseEvent.MOUSE_CLICKED, (ev) -> handleMouseClicked(ev));
addEventFilter(MouseEvent.MOUSE_DRAGGED, (ev) -> handleMouseDragged(ev));
addEventFilter(MouseEvent.MOUSE_EXITED, (ev) -> handleMouseExited(ev));
}