// dialogs public void showWarningDialog(String warning) { warningDialog_.setWarning(warning); warningDialog_.setVisible(true); }
/** Handle action events. */ public void actionPerformed(ActionEvent event) { JButton jbn; String somestr = null; // System.out.println("Debug:IconToolBox:actionPerformed: "+event.getSource().toString()); if (parentFrame.currModule == null) { warningPopup4.display("IconToolBox: Must use File Menu to create Icon first."); return; } if (event.getSource() instanceof JButton) { jbn = (JButton) event.getSource(); String somestr2 = event.getActionCommand(); somestr = jbn.getText(); // System.out.println("Debug:IconToolBox: JButton: somestr:" + somestr); // System.out.println("Debug:IconToolBox: JButton: somestr2:" + somestr2); // ----------------------------------- if (somestr.equals("Move")) { status = "move"; parentFrame.myIconPanel.newstatus(); return; } // ----------------------------------- if (somestr.equals("Clear")) { String qstring = "IconToolBox:Are you sure you want to clear the screen?"; boolean okPressed = okCancelPopup4.display(qstring); if (okPressed) { status = "clear"; } else { status = "nothing"; } parentFrame.myIconPanel.newstatus(); return; } // -------------------------------------- if (somestr.equals("InPort")) { doPort("InputPort"); parentFrame.myIconPanel.newstatus(); return; } // ----------------------------------- if (somestr.equals("OutPort")) { doPort("OutputPort"); parentFrame.myIconPanel.newstatus(); return; } // ----------------------------------- if (somestr.equals("Text")) { parentFrame.myIconPanel.setCursor(new Cursor(Cursor.TEXT_CURSOR)); // show the option panel *nitgupta* // System.out.print("text selected "); GetNamePopup ie = new GetNamePopup((Frame) parentFrame, SCSUtility.maxCharsFreeText); ie.setSize(300, 100); ie.show(); if (ie.status.equals("ok") == true) { status = "insert_text"; IconPanel.text_string = ie.NameTF.getText(); } else { IconPanel.text_string = ""; status = "nothing"; } parentFrame.myIconPanel.newstatus(); return; } // -------------------- if (somestr.equals("Line")) { status = "insert_line"; parentFrame.myIconPanel.setCursor(new Cursor(Cursor.HAND_CURSOR)); parentFrame.myIconPanel.newstatus(); return; } // -------------------- if (somestr.equals("Oval")) { status = "insert_oval"; parentFrame.myIconPanel.setCursor(new Cursor(Cursor.HAND_CURSOR)); parentFrame.myIconPanel.newstatus(); return; } // -------------------- if (somestr.equals("Rectangle")) { status = "insert_rect"; parentFrame.myIconPanel.setCursor(new Cursor(Cursor.HAND_CURSOR)); parentFrame.myIconPanel.newstatus(); return; } // -------------------- if (somestr.equals("Polygon")) { status = "insert_poly"; parentFrame.myIconPanel.setCursor(new Cursor(Cursor.HAND_CURSOR)); parentFrame.myIconPanel.newstatus(); return; } // -------------------- warningPopup4.display("IconToolBox:JButton but no one claimed it."); return; } // end if JButton warningPopup4.display("IconToolBox:Event but no button or menu item claimed it."); }