Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static String[] Maps = { };
- static JComboBox<String> cb = new JComboBox<String>(directions);
- ==========================================
- public static void loadAThing{
- EventQueue.invokeLater(new Runnable() {
- @Override
- public void run() {
- JButton button = new JButton("Enter");
- int xlenght = findLength(map) + 1;
- button.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent ev) {
- String filecontents = "";
- FileReader fr = null;
- try {
- fr = new FileReader(("resources/" + cb.ToString));
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- int i;
- if (fr != null) {
- try {
- while ((i = fr.read()) != -1) {
- filecontents = filecontents + (char) i;
- }
- } catch (IOException | NullPointerException n) {
- n.printStackTrace();
- }
- try {
- fr.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- });
- Object[] options = new Object[] {};
- JOptionPane frame = new JOptionPane("Please Select", JOptionPane.QUESTION_MESSAGE, JOptionPane.DEFAULT_OPTION,
- null, options, null);
- frame.add(cb);
- frame.add(cb1);
- frame.add(button);
- JDialog diag = new JDialog();
- diag.getContentPane().add(frame);
- diag.pack();
- diag.setVisible(true);
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement