checker-framework icon indicating copy to clipboard operation
checker-framework copied to clipboard

Inbuilt Functions with arguments not working

Open shivanshsoni opened this issue 9 years ago • 4 comments

Inbuilt functions such as setDefaultCloseOperation(int), setJmenuBar(), getContentPane() and other functions not working in java

My code: import java.util.* ; import java.awt.* ; import java.awt.event.* ;

import javax.swing.* ; import javax.accessibility.* ;

public class BigExample extends JFrame {

public BigExample() { super("Big Accessibility Example"); setSize(700,500); setDefaultCloseOperation(EXIT_ON_CLOSE);

JMenuBar jmb = new JMenuBar();
JMenu fileMenu = new JMenu("File");
JMenuItem openItem = new JMenuItem("Open");
JMenuItem saveItem = new JMenuItem("Save");
JMenuItem exitItem = new JMenuItem("Exit");
exitItem.addActionListener(new ActionListener() {
  public void actionPerformed(ActionEvent ae) {
    System.exit(0);
  }
});

fileMenu.add(openItem);
fileMenu.add(saveItem);
fileMenu.add(new JSeparator());
fileMenu.add(exitItem);
jmb.add(fileMenu);
setJMenuBar(jmb);

JTextArea jta = new JTextArea("[Notes]\n");
JScrollPane sp1 = new JScrollPane(jta);
sp1.setMinimumSize(new Dimension(200,200));
sp1.setPreferredSize(new Dimension(200,200));

String[] titles = { "Name", "Start Date", "Job Title" };
String[][] data = {
  {"Jordan", "2001", "Director"},
  {"Naveen", "1999", "Programmer"},
  {"Jia", "2000", "Analyst"},
  {"Brooks", "1998", "Evangelist"}
};
JTable table = new JTable(data, titles);
table.getAccessibleContext().setAccessibleDescription("Employee Statistics");
JPanel rightPane = new JPanel(new BorderLayout());
rightPane.add(new JScrollPane(table), BorderLayout.CENTER);
rightPane.add(new JLabel(new ImageIcon("logo.gif")), BorderLayout.SOUTH);

JSplitPane jsp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp1, rightPane);

getContentPane().add(jsp, BorderLayout.CENTER);

JPanel bPane = new JPanel();
JButton okButton = new JButton("Ok");
JButton applyButton = new JButton("Apply");
JButton clearButton = new JButton("Clear");
bPane.add(okButton);
bPane.add(applyButton);
bPane.add(clearButton);

getContentPane().add(bPane, BorderLayout.SOUTH);

setVisible(true);

}

public static void main(String args[]) { new BigExample(); } }

shivanshsoni avatar Apr 02 '17 12:04 shivanshsoni

Errors I am getting

screenshot 33

shivanshsoni avatar Apr 02 '17 12:04 shivanshsoni

@shivanshsoni How is this issue different from #1188 that you also filed?

wmdietl avatar Apr 03 '17 06:04 wmdietl

Closing as a duplicate.

mernst avatar Apr 03 '17 19:04 mernst

ya it was just extension of #1188 . Sorry!

shivanshsoni avatar Apr 11 '17 18:04 shivanshsoni