B4J Question How do I add JButton to a PaneWrapper in a Java wrapper for use in B4J ?

ANTONIO ALBEIRO VALENCIA

Member
Licensed User
Longtime User
Hello everyone

I am making a wrapper in java to use it in B4J. I Use JButton from the javax.swing.JButton library.
How to add JButton to a PaneWrapper to use it in B4J ?

Add JButton to PaneWrapper:
public void AddButton( anywheresoftware.b4j.objects.PaneWrapper panel )  {
 
    ImageIcon icon = new ImageIcon("E:\\java projects\\test\\src\\images\\logout.png");
    JButton button = new JButton("Click Me    ", icon);
    button.setBounds(50, 50, 200, 100);

    // Set text position relative to icon
    button.setVerticalTextPosition(SwingConstants.CENTER);
    button.setHorizontalTextPosition(SwingConstants.LEFT);

    button.setBorderPainted(true);
    button.setForeground(Color.black);
    button.setBackground(Color.GREEN);

    panel.AddNode(button, 0, 0, 200, 100);  <----- Here I need add the button to the panel
    
  }
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

ANTONIO ALBEIRO VALENCIA

Member
Licensed User
Longtime User
Hi All,

A video of the library in operation

English : A video of the ButtonBar.jar library in operation for use with B4J. It does not use designer-created controls; it's just JavaFX code.

Spanish : Un video del funcionamiento de la libreria ButtonBar.jar para uso con B4J, no usa controles creados con diseñador, es solo codigo javaFX


 
Last edited:
Upvote 0
Top