canvas.showSettingsFrame();
}
public static WiGiGUI init() {
GraphsPathFilter.init();
PaintBean pb = new PaintBean();
// pb.setSelectedFile( Settings.GRAPHS_PATH + "UserStudy/testGraphs/graph1large.dnv" );
// pb.setSelectedFile( Settings.GRAPHS_PATH + "UserStudy/testGraphs/graph1large.dnv" );
pb.setWhiteSpaceBuffer( 0.14f );
pb.setDrawNeighborHighlight( true );
pb.setInterpolationMethodUseWholeGraph( true );
pb.setScalePositions( true );
pb.setPlaySound( true );
JFrame frame = new JFrame( "WiGi - GUI" );
frame.setSize( 800, 800 );
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
JFrame overviewFrame = new JFrame("Overview");
WiGiGUIHandler handler = new WiGiGUIHandler( pb, overviewFrame );
handler.setWiGiDockIcon();
frame.setIconImage( handler.getWigiIconImage() );
overviewFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
overviewFrame.setUndecorated( true );
overviewFrame.setSize( WiGiOverviewPanel.OVERVIEW_SIZE, WiGiOverviewPanel.OVERVIEW_SIZE );
overviewFrame.setResizable( false );
overviewFrame.setIconImage( handler.getWigiIconImage() );
GLCapabilities caps = new GLCapabilities();
caps.setDoubleBuffered( true );
caps.setHardwareAccelerated( true );
WiGiOverviewPanel overviewPanel = new WiGiOverviewPanel( pb );
overviewFrame.getContentPane().add( overviewPanel );
caps = new GLCapabilities();
caps.setDoubleBuffered( true );
caps.setHardwareAccelerated( true );
WiGiGUI canvas = new WiGiGUI( caps, pb, frame, overviewFrame, handler );
overviewPanel.setRenderComponent( canvas );
canvas.setBounds( 0, 0, pb.getWidthInt(), pb.getHeightInt() );
// canvas.setDoubleBuffered( true );
canvas.addMouseListener( canvas );
canvas.addMouseMotionListener( canvas );
canvas.addMouseWheelListener( canvas );
canvas.addKeyListener( canvas );
canvas.getSettingsFrame().setIconImage( handler.getWigiIconImage() );
frame.addComponentListener( canvas );
frame.addKeyListener( canvas );
frame.add( canvas );
// moveOverview();
// Placing window in the center of the screen
// Get the size of the screen
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
// Determine the new location of the window
int w = frame.getSize().width;
int h = frame.getSize().height;
int x = (dim.width-w)/2;
int y = (dim.height-h)/2;
// Move the window
frame.setLocation( x, y );
frame.setVisible( true );
overviewFrame.setBounds( frame.getX() + frame.getWidth() + 10, frame.getY(), WiGiOverviewPanel.OVERVIEW_SIZE, WiGiOverviewPanel.OVERVIEW_SIZE );
overviewFrame.setVisible(true);
pb.setWidth( canvas.getWidth() );
pb.setHeight( canvas.getHeight() );
return canvas;
}