package jfparted;
/**
* Created : Apr 13, 2012
*
* @author pquiring
*/
import java.awt.Dimension;
import java.awt.GraphicsEnvironment;
import java.awt.Rectangle;
import javaforce.*;
import javaforce.jbus.*;
public class PartitionEditorApp extends javax.swing.JFrame {
/**
* Creates new form PartitionEditorApp
*/
public PartitionEditorApp() {
initComponents();
JFLog.init(JF.getUserPath() + "/.jfparted.log", true);
jbusClient = new JBusClient(null, null);
jbusClient.start();
jbusClient.call("org.jflinux.jfsystemmgr", "stopAutoMounter", ""); //annoying
setContentPane(new PartitionEditorPanel(true));
setPosition();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Partition Editor");
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
formWindowClosing(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 644, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 327, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
jbusClient.call("org.jflinux.jfsystemmgr", "startAutoMounter", "");
System.exit(0);
}//GEN-LAST:event_formWindowClosing
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/*
* Create and display the form
*/
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new PartitionEditorApp().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
private void setPosition() {
Dimension d = getSize();
Rectangle s = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
if ((d.width > s.width) || (d.height > s.height)) {
if (d.width > s.width) d.width = s.width;
if (d.height > s.height) d.height = s.height;
setSize(d);
}
setLocation(s.width/2 - d.width/2, s.height/2 - d.height/2);
}
private JBusClient jbusClient;
}