2 Replies - 5347 Views - Last Post: 17 November 2012 - 06:07 AM Rate Topic: -----

#1 crabby   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 16-November 12

Adding JavaFX Content to a Swing Component Using Jbutton

Posted 16 November 2012 - 04:26 AM

hi, I'm newbie in here,
how to open a new java file that contain JavaFX Content using Jbutton? I have a project to make a simulation generator,
I have one menu Jframe form, and I want to open another Jframe that integrated with JavaFX Content using Jbutton.
can you give me some source code to help me solve it.


here's my source code:

public class menu extends javax.swing.JFrame implements ActionListener {

    private static final long serialVersionUID = 1L;
    
    
    private Fx fx;
    /**
     * Creates new form menu
     */
    public menu() {
        initComponents();
        //super();
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setTitle("SIM-G (Simulation Generator)");
        setSize(810, 610);
        setResizable(false);
        file_open.addActionListener(this);
        file_saveas.addActionListener(this);
    }


@Override
    public void setVisible(boolean B)/>{
        if (B)/> {
            
            setLocationRelativeTo(null);
         
            Point point = getLocation();
       
            setLocation(new Point(point.x, 0 - getHeight()));
   
            fx = new MoveToFx(point);
         
            fx.setComponent(this);
       
            super.setVisible(B)/>;
          
            fx.runFx();
        } else {
            super.setVisible(B)/>;
        }
    }




private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
        
    }


Is This A Good Question/Topic? 0
  • +

Replies To: Adding JavaFX Content to a Swing Component Using Jbutton

#2 farrell2k   User is offline

  • D.I.C Lover
  • member icon

Reputation: 874
  • View blog
  • Posts: 2,706
  • Joined: 29-July 11

Re: Adding JavaFX Content to a Swing Component Using Jbutton

Posted 16 November 2012 - 10:52 AM

If you have a JFrame that contains JavaFX content, showing that Jframe is as easy as calling setVisible(true) on it, but here is information from Oracle on mixing Swing and JavaFX.
Was This Post Helpful? 1
  • +
  • -

#3 crabby   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 16-November 12

Re: Adding JavaFX Content to a Swing Component Using Jbutton

Posted 17 November 2012 - 06:07 AM

thank you
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1