Search in sources :

Example 31 with Window

use of org.apache.pivot.wtk.Window in project pivot by apache.

the class Pivot800 method startup.

@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
    Window window = new Window();
    window.setMaximized(true);
    sheet = new FileBrowserSheet(FileBrowserSheet.Mode.SAVE_TO);
    sheet.getWindowStateListeners().add(new SelectFileListener());
    window.open(display);
    sheet.open(window);
}
Also used : Window(org.apache.pivot.wtk.Window) FileBrowserSheet(org.apache.pivot.wtk.FileBrowserSheet)

Example 32 with Window

use of org.apache.pivot.wtk.Window in project pivot by apache.

the class Pivot837 method startup.

@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
    BXMLSerializer bxmlSerializer = new BXMLSerializer();
    Window window = (Window) bxmlSerializer.readObject(getClass().getResource("pivot_837.bxml"));
    window.open(display);
}
Also used : Window(org.apache.pivot.wtk.Window) BXMLSerializer(org.apache.pivot.beans.BXMLSerializer)

Example 33 with Window

use of org.apache.pivot.wtk.Window in project pivot by apache.

the class Pivot951 method startup.

@Override
public void startup(Display display, Map<String, String> properties) {
    window = new Window();
    Border brd = new Border();
    brd.getComponentMouseButtonListeners().add(new ComponentMouseButtonListener() {

        @Override
        public boolean mouseClick(Component component, Button button, int x, int y, int count) {
            if (count == 1) {
                System.out.println("Click!");
            } else {
                System.out.println("Double Click!");
            }
            return true;
        }
    });
    window.setContent(brd);
    window.setTitle("Pivot951: Cannot click twice");
    window.setMaximized(true);
    window.open(display);
}
Also used : Window(org.apache.pivot.wtk.Window) Button(org.apache.pivot.wtk.Mouse.Button) ComponentMouseButtonListener(org.apache.pivot.wtk.ComponentMouseButtonListener) Component(org.apache.pivot.wtk.Component) Border(org.apache.pivot.wtk.Border)

Example 34 with Window

use of org.apache.pivot.wtk.Window in project pivot by apache.

the class HelloJava method startup.

@Override
public void startup(Display display, Map<String, String> properties) {
    this.window = new Window();
    Label label = new Label();
    label.setText("Hello World!");
    label.getStyles().put(Style.font, new Font("Arial", Font.BOLD, 24));
    label.getStyles().put(Style.color, Color.RED);
    label.getStyles().put(Style.horizontalAlignment, HorizontalAlignment.CENTER);
    label.getStyles().put(Style.verticalAlignment, VerticalAlignment.CENTER);
    this.window.setContent(label);
    this.window.setTitle("Hello World!");
    this.window.setMaximized(true);
    this.window.open(display);
}
Also used : Window(org.apache.pivot.wtk.Window) Label(org.apache.pivot.wtk.Label) Font(java.awt.Font)

Example 35 with Window

use of org.apache.pivot.wtk.Window in project pivot by apache.

the class FileBrowserWithCharsetTest method startup.

@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
    BoxPane windowContent = new BoxPane();
    windowContent.getStyles().put(Style.verticalAlignment, VerticalAlignment.CENTER);
    final Checkbox showHiddenCheckbox = new Checkbox("Show hidden files");
    windowContent.add(showHiddenCheckbox);
    PushButton button = new PushButton("Open File Browser");
    button.getStyles().put(Style.padding, "[2, 4, 2, 4]");
    button.getButtonPressListeners().add(new ButtonPressListener() {

        @Override
        public void buttonPressed(Button buttonArgument) {
            final Window window = Window.getActiveWindow();
            final FileBrowserWithCharsetTest fileBrowserSheet = new FileBrowserWithCharsetTest(FileBrowserSheet.Mode.OPEN);
            fileBrowserSheet.getStyles().put(Style.showHiddenFiles, showHiddenCheckbox.isSelected());
            fileBrowserSheet.open(window, new SheetCloseListener() {

                @Override
                public void sheetClosed(Sheet sheet) {
                    if (sheet.getResult()) {
                        Sequence<File> selectedFiles = fileBrowserSheet.getSelectedFiles();
                        ListView listView = new ListView();
                        listView.setListData(new ArrayList<>(selectedFiles));
                        listView.setSelectMode(ListView.SelectMode.NONE);
                        listView.getStyles().put(Style.backgroundColor, null);
                        Alert.alert(MessageType.INFO, "You selected (charset " + fileBrowserSheet.getCharsetName() + "):", listView, window);
                    } else {
                        Alert.alert(MessageType.INFO, "You didn't select anything.", window);
                    }
                }
            });
        }
    });
    windowContent.add(button);
    frame = new Frame(windowContent);
    frame.setMaximized(true);
    frame.open(display);
}
Also used : Window(org.apache.pivot.wtk.Window) Frame(org.apache.pivot.wtk.Frame) SheetCloseListener(org.apache.pivot.wtk.SheetCloseListener) ButtonPressListener(org.apache.pivot.wtk.ButtonPressListener) ListView(org.apache.pivot.wtk.ListView) BoxPane(org.apache.pivot.wtk.BoxPane) PushButton(org.apache.pivot.wtk.PushButton) Button(org.apache.pivot.wtk.Button) ListButton(org.apache.pivot.wtk.ListButton) Checkbox(org.apache.pivot.wtk.Checkbox) PushButton(org.apache.pivot.wtk.PushButton) Sheet(org.apache.pivot.wtk.Sheet) FileBrowserSheet(org.apache.pivot.wtk.FileBrowserSheet) File(java.io.File)

Aggregations

Window (org.apache.pivot.wtk.Window)45 Component (org.apache.pivot.wtk.Component)14 BXMLSerializer (org.apache.pivot.beans.BXMLSerializer)13 PushButton (org.apache.pivot.wtk.PushButton)9 BoxPane (org.apache.pivot.wtk.BoxPane)8 Button (org.apache.pivot.wtk.Button)7 ButtonPressListener (org.apache.pivot.wtk.ButtonPressListener)6 Display (org.apache.pivot.wtk.Display)5 Border (org.apache.pivot.wtk.Border)4 Label (org.apache.pivot.wtk.Label)4 Sheet (org.apache.pivot.wtk.Sheet)4 TablePane (org.apache.pivot.wtk.TablePane)4 File (java.io.File)3 Bounds (org.apache.pivot.wtk.Bounds)3 Point (org.apache.pivot.wtk.Point)3 IOException (java.io.IOException)2 MalformedURLException (java.net.MalformedURLException)2 SerializationException (org.apache.pivot.serialization.SerializationException)2 Vote (org.apache.pivot.util.Vote)2 TaskExecutionException (org.apache.pivot.util.concurrent.TaskExecutionException)2