//Frame got visible but buttons on it are not displaying. ProcessBuilder to execute a.sh and we need to wait for completion of this process . Call to showFrame() display the Frames without button and labels but as soon as the Process completes complete Frame become visible.
showFrame();
Process test=null;
try {
test = new ProcessBuilder("sh" ,"config/a.sh").start();
test.waitFor();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
private void showFrame() {
JFrame fr = new JFrame("Operations");
fr.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
fr.setBounds(100,100,600,500);
fr.setSize(500, 500);
JButton b1 = new JButton("PORT30");
JLabel l1 = new JLabel("TRACKER");
l1.setBounds(100,70,100,100);
fr.setLayout(null);
JLabel l2 = new JLabel("NODE");
l2.setBounds(100,170,100,100);
b1.setBounds(300,100,160,50);
JButton b2 = new JButton("PORT70");
b2.setBounds(300,200,160,50);
fr.add(b1);
fr.add(b2);
fr.add(l2);
fr.add(l1);
fr.setVisible(true);
l1.setVisible(true);
l2.setVisible(true);
b1.setVisible(true);
b2.setVisible(true);