use of org.apache.pivot.wtk.LinkButton in project pivot by apache.
the class BXMLExplorerDocument method setComponentIconOnTreeNode.
private static void setComponentIconOnTreeNode(TreeNode treeNode, Object comp) {
String resource = null;
if (comp instanceof Label) {
resource = "label.png";
}
if (comp instanceof ImageView) {
resource = "/org/apache/pivot/tutorials/IMG_0725_2.jpg";
}
if (comp instanceof PushButton) {
resource = "pushbutton.png";
}
if (comp instanceof RadioButton) {
resource = "radiobutton.png";
}
if (comp instanceof Checkbox) {
resource = "checkbox.png";
}
if (comp instanceof LinkButton) {
resource = "linkbutton.png";
}
if (comp instanceof TablePane) {
resource = "tablepane.png";
}
if (resource != null) {
URL url = BXMLExplorerDocument.class.getResource(resource);
if (url == null) {
throw new IllegalStateException("could not load resource " + resource);
}
treeNode.setIcon(url);
}
}
use of org.apache.pivot.wtk.LinkButton in project pivot by apache.
the class LinkButtonTest method startup.
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
BoxPane boxPane = new BoxPane();
boxPane.getStyles().put(Style.verticalAlignment, VerticalAlignment.CENTER);
boxPane.getStyles().put(Style.spacing, 8);
boxPane.getComponentMouseListeners().add(new ComponentMouseListener() {
@Override
public boolean mouseMove(Component component, int x, int y) {
System.out.println("BOX PANE " + x + ", " + y);
return false;
}
@Override
public void mouseOver(Component component) {
// empty block
}
@Override
public void mouseOut(Component component) {
// empty block
}
});
Image image = Image.load(getClass().getResource("go-home.png"));
LinkButton linkButton = null;
linkButton = new LinkButton("ABCDE");
boxPane.add(linkButton);
linkButton.getComponentMouseListeners().add(new ComponentMouseListener() {
@Override
public boolean mouseMove(Component component, int x, int y) {
return true;
}
@Override
public void mouseOver(Component component) {
// empty block
}
@Override
public void mouseOut(Component component) {
// empty block
}
});
linkButton = new LinkButton(image);
boxPane.add(linkButton);
linkButton = new LinkButton(new ButtonData(image, "12345"));
boxPane.add(linkButton);
window.setContent(boxPane);
window.open(display);
}
use of org.apache.pivot.wtk.LinkButton in project pivot by apache.
the class TerraLinkButtonSkin method paint.
@Override
public void paint(Graphics2D graphics) {
LinkButton linkButton = (LinkButton) getComponent();
Dimensions size = getSize();
Button.DataRenderer dataRenderer = linkButton.getDataRenderer();
dataRenderer.render(linkButton.getButtonData(), linkButton, highlighted);
dataRenderer.setSize(size);
dataRenderer.paint(graphics);
}
use of org.apache.pivot.wtk.LinkButton in project pivot by apache.
the class LinkButtonSkin method mouseClick.
@Override
public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count) {
boolean consumed = super.mouseClick(component, button, x, y, count);
if (button == Mouse.Button.LEFT) {
LinkButton linkButton = (LinkButton) getComponent();
linkButton.press();
}
return consumed;
}
use of org.apache.pivot.wtk.LinkButton in project pivot by apache.
the class TerraLinkButtonSkin method getBaseline.
@Override
public int getBaseline(int width, int height) {
LinkButton linkButton = (LinkButton) getComponent();
Button.DataRenderer dataRenderer = linkButton.getDataRenderer();
dataRenderer.render(linkButton.getButtonData(), linkButton, false);
return dataRenderer.getBaseline(width, height);
}
Aggregations