JavaFX: DesktopPane and InternalFrame components.

I was showing a buddy of mine JavaFX and he asked about the JDesktopPane. I didn't see one created, and I wanted to show him how easy it was to create components so I did it.

I'm sure there is plenty of room for more, but here's my first run at it.

package javafx.ext.swing;
 
import javax.swing.*;
import java.lang.*;
 
/**
 * @author eberry
 */
 
public class DesktopPane extends Component {
 
    private attribute desktop: JDesktopPane;
 
    public attribute frames: InternalFrame[] on replace {
        for(frame in frames) {
            desktop.add(frame.internalFrame);
        }
    }
 
    public function createJComponent(): javax.swing.JComponent {
        desktop = new JDesktopPane();
        return desktop;
    }
}

package javafx.ext.swing;
 
import javax.swing.*;
 
/**
 * @author eberry
 */
 
public class InternalFrame extends Component {
 
    attribute internalFrame: JInternalFrame;
 
    public attribute title: String on replace {
        internalFrame.setTitle(title);
    }
 
    public attribute resizable: Boolean on replace {
        internalFrame.setResizable(resizable);
    }
 
    public attribute closable: Boolean on replace {
        internalFrame.setClosable(closable);
    }
 
    public attribute maximizable: Boolean on replace {
        internalFrame.setMaximizable(maximizable);
    }
 
    public attribute iconifiable: Boolean on replace {
        internalFrame.setIconifiable(iconifiable);
    }
 
    public attribute frameIcon: Icon on replace {
        internalFrame.setFrameIcon(frameIcon.getToolkitIcon());
    }
 
    public function createJComponent(): JComponent {
        internalFrame = new JInternalFrame();
        internalFrame.setVisible(true);
        return internalFrame;
    }
 
}

Cheers,
Eric

PS: I've got another installment of the TicTacToe game coming up. I've made the winner much clearer, and I'm hoping to integrate JFugue into it as well.

AttachmentSize
InternalFrame.fx1.08 KB
Main.fx1.06 KB
DesktopPane.fx551 bytes