Skip to main content

Tabbed Pane or similar?

3 replies [Last post]
ferdinandogranelli
Offline
Joined: 2007-11-20
Points: 0

I'm doing this program --> http://gwt.google.com/samples/Mail/Mail.html in java fx
and java (with swing)... Anyone know if there is a container similar at the left menu (Mail, Tasks, Contacts)

Thanks in advance!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
dnivra
Offline
Joined: 2007-01-11
Points: 0

i'm not sure if there is a pre-existing JavaFX widget that does this but I was able to put something together using the Box layout.

Arvi

import javafx.ui.*;

var mail:Boolean = true;
var contacts:Boolean = false;
var tasks:Boolean = false;
Box {
orientation: VERTICAL
alignmentY: 0
content: [
Box {
orientation: VERTICAL
content: [
Button {
text: "Mail"
action: operation() {
mail = true;
contacts = false;
tasks = false;
}
},
SimpleLabel {text: "Item 1" visible: bind mail},
SimpleLabel {text: "Item 2" visible: bind mail}
]
},
Box {
orientation: VERTICAL
content: [
Button {
text: "Tasks"
action: operation() {
mail = false;
contacts = false;
tasks = true;
}
},
SimpleLabel {text: "Clean" visible: bind tasks},
SimpleLabel {text: "Cook" visible: bind tasks}
]
},

Box {
orientation: VERTICAL
content: [
Button {
text: "Contacts"
action: operation() {
mail = false;
contacts = true;
tasks = false;
}
},
SimpleLabel {text: "Address book" visible: bind contacts},
SimpleLabel {text: "Friends" visible: bind contacts}
]
}
]
};

ferdinandogranelli
Offline
Joined: 2007-11-20
Points: 0

It's a good Idea , but if I insert your "multi" box in the content the frame doesn't change..
maybe I I make some mistakes...

thank you in advance.

import javafx.ui.*;

Frame {
height: 120
width: 500
content: bind [ Your code ]
visible: true
}

alexsch
Offline
Joined: 2007-07-12
Points: 0

Tthe code works fine for me. Do you use the latest JavaFX Script runtime?

[code]
import javafx.ui.*;

var mail:Boolean = true;
var contacts:Boolean = false;
var tasks:Boolean = false;

var box = Box {
orientation: VERTICAL
alignmentY: 0
content: [
Box {
orientation: VERTICAL
content: [
Button {
text: "Mail"
action: operation() {
mail = true;
contacts = false;
tasks = false;
}
},
SimpleLabel {text: "Item 1" visible: bind mail},
SimpleLabel {text: "Item 2" visible: bind mail}
]
},
Box {
orientation: VERTICAL
content: [
Button {
text: "Tasks"
action: operation() {
mail = false;
contacts = false;
tasks = true;
}
},
SimpleLabel {text: "Clean" visible: bind tasks},
SimpleLabel {text: "Cook" visible: bind tasks}
]
},

Box {
orientation: VERTICAL
content: [
Button {
text: "Contacts"
action: operation() {
mail = false;
contacts = true;
tasks = false;
}
},
SimpleLabel {text: "Address book" visible: bind contacts},
SimpleLabel {text: "Friends" visible: bind contacts}
]
}
]
};

Frame {
height: 150
width: 200
content: box
visible: true
}
[/code]