This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes JavaFX and the fly likes custom swing panel does not display Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » JavaFX
Bookmark "custom swing panel does not display" Watch "custom swing panel does not display" New topic

custom swing panel does not display

Jordan Thompson

Joined: Nov 09, 2009
Posts: 29
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.setSize(1200, 800);

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,

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,

No matter where you go - there you are
-- Buckaroo Banzai
Jordan Thompson

Joined: Nov 09, 2009
Posts: 29
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.
I agree. Here's the link:
subject: custom swing panel does not display
It's not a secret anymore!