use of javafx.scene.control.RadioMenuItem in project Gargoyle by callakrsos.
the class DesignerFx method createFxMenuBar.
// private JMenuBar createMenuBar() {
// JMenuBar menuBar = new JMenuBar();
// JMenu menu = new JMenu("Language");
// ButtonGroup group = new ButtonGroup();
//
// LanguageVersion[] languageVersions = getSupportedLanguageVersions();
// for (int i = 0; i < languageVersions.length; i++) {
// LanguageVersion languageVersion = languageVersions[i];
// MenuItem button = new MenuItem(languageVersion.getShortName());
// languageVersionMenuItems[i] = button;
// group.add(button);
// menu.add(button);
// }
// languageVersionMenuItems[DEFAULT_LANGUAGE_VERSION_SELECTION_INDEX].setSelected(true);
// menuBar.add(menu);
//
// JMenu actionsMenu = new JMenu("Actions");
// JMenuItem copyXMLItem = new JMenuItem("Copy xml to clipboard");
// copyXMLItem.addActionListener(new ActionListener() {
// public void actionPerformed(ActionEvent e) {
// copyXmlToClipboard();
// }
// });
// actionsMenu.add(copyXMLItem);
// JMenuItem createRuleXMLItem = new JMenuItem("Create rule XML");
// createRuleXMLItem.addActionListener(new ActionListener() {
// public void actionPerformed(ActionEvent e) {
// createRuleXML();
// }
// });
// actionsMenu.add(createRuleXMLItem);
// menuBar.add(actionsMenu);
//
// return menuBar;
// }
private MenuBar createFxMenuBar() {
MenuBar menuBar = new MenuBar();
Menu menu = new Menu("Language");
ToggleGroup group = new ToggleGroup();
LanguageVersion[] languageVersions = getSupportedLanguageVersions();
for (int i = 0; i < languageVersions.length; i++) {
LanguageVersion languageVersion = languageVersions[i];
// JRadioButtonMenuItem button = new JRadioButtonMenuItem(languageVersion.getShortName());
RadioMenuItem button = new RadioMenuItem(languageVersion.getShortName());
button.setToggleGroup(group);
languageVersionMenuItems[i] = button;
// group.add(button);
menu.getItems().add(button);
}
// languageVersionMenuItems[DEFAULT_LANGUAGE_VERSION_SELECTION_INDEX].setSelected(true);
languageVersionMenuItems[getDefaultLanguageVersionSelectionIndex()].setSelected(true);
menuBar.getMenus().add(menu);
Menu actionsMenu = new Menu("Actions");
MenuItem copyXMLItem = new MenuItem("Copy xml to clipboard");
copyXMLItem.setOnAction(e -> copyXmlToClipboard());
actionsMenu.getItems().add(copyXMLItem);
MenuItem createRuleXMLItem = new MenuItem("Create rule XML");
createRuleXMLItem.setOnAction(e -> createRuleXML());
actionsMenu.getItems().add(createRuleXMLItem);
menuBar.getMenus().add(actionsMenu);
return menuBar;
}
use of javafx.scene.control.RadioMenuItem in project Gargoyle by callakrsos.
the class LogViewController method onAfter.
@FxPostInitialize
public void onAfter() throws IOException {
File monitoringFile = composite.getMonitoringFile();
fileChannel = FileChannel.open(monitoringFile.toPath(), StandardOpenOption.READ);
buffer = ByteBuffer.allocate(seekSize);
String encoding = ResourceLoader.loadCharset();
if (Charset.isSupported(encoding)) {
charset.set(Charset.forName(encoding));
} else {
LOGGER.info("does not supported encoding {} , default utf-8 setting. ", encoding);
encoding = "UTF-8";
charset.set(Charset.forName(encoding));
}
//설정에 저장된 인코딩셋을 불러와 디폴트로 선택되게함.
ObservableList<Toggle> toggles = ENCODING.getToggles();
toggles.stream().map(tg -> {
if (tg instanceof RadioMenuItem) {
RadioMenuItem r = (RadioMenuItem) tg;
if (r.getText().toUpperCase().equals(charset.get().name().toUpperCase())) {
return r;
}
}
return null;
}).filter(v -> v != null).findFirst().ifPresent(rmi -> {
rmi.setSelected(true);
});
//캐릭터셋이 변경될때 환경변수에 등록하는 과정
this.charset.addListener((oba, o, newCharset) -> {
String name = newCharset.name();
if (ValueUtil.isEmpty(name)) {
return;
}
ResourceLoader.saveCharset(name);
});
}
use of javafx.scene.control.RadioMenuItem in project jgnash by ccavanaugh.
the class ThemeManager method addKnownThemes.
public static void addKnownThemes(@NotNull final Menu menu) {
Objects.requireNonNull(menu);
themesMenu = menu;
for (final String[] theme : KNOWN_THEMES) {
final RadioMenuItem radioMenuItem = new RadioMenuItem(theme[0]);
radioMenuItem.setUserData(theme[1]);
radioMenuItem.setOnAction(themeHandler);
radioMenuItem.setToggleGroup(toggleGroup);
themesMenu.getItems().add(radioMenuItem);
}
JavaFXUtils.runLater(ThemeManager::syncRadioMenuItem);
}
Aggregations