• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

custom swing panel does not display

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI there,
I have a custom swing panel (LoggerView) that extends JPanel and seems to work fine in java:

static public void main(String[] args) throws InvalidUserException, SQLException {

JFrame frame = new JFrame();
frame.add(new LoggerView());
frame.setVisible(true);
frame.setSize(1200, 800);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

When I try to use it in javafx app, it fills in the area like its trying to paint, but it does not appear (the areachart works fine as it is a javafx component):

var loggerView = new LoggerView();
loggerView.setPreferredSize(new java.awt.Dimension(1200,800));
var loggerComponent = SwingComponent.wrap(loggerView);

loggerComponent.clip = Rectangle {
width: 1200
height: 800
arcHeight: 20
arcWidth: 20
};


Stage {
title: "Persys Logger View"
scene: Scene {
content: HBox {
content: [loggerComponent,
createAreaChart()]
}
}
}


What am I missing? as you can see from the java code, I don't need to call anything to get it to render.

thanks for your help in advance,
Jordan
 
Jordan Thompson
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK - I feel foolish - thats what happens when you stare at the same code for too long. I wasn't initializing th e components in my hastily created empty constructor.
 
My favorite is a chocolate cupcake with white frosting and tiny ad sprinkles.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic