Remove from Main Window

Hi all,
I'm having some trouble removing text from labels in my main window.
I have a main window which has a JMenuBar. On the MenuBar I have a options > file> Remove Menu Item.
When I select the Remove Menu Item, a Remove Dialog opens up with a JList and a Remove button.
The JList is populated by a column (queueName) from my table "testtable".
When I select a particular entry from the Jlist and click "Remove" the entry is removed from the list and my database but not from my main window.
How can i go about removing entry from my main window??
Here is the necessary code:
public class MainWindowClass extends JFrame implements ActionListener {   
    private JPanel prodEastPanel;
    private JPanel prodPanel;
    private JPanel prodWestPanel;
    private JMenuBar menuBar = null;
    private JMenu fileMenu,  optionsMenu = null;
    private JMenuItem exitMI,  removeMI = null;
    JLabel[] prdLabelArray = new JLabel[12];
    ArrayList rec = new ArrayList();
    DBConnection dbc = new DBConnection();
    public MainWindowClass() {
        initComponents();
    private void initComponents() {
        prodPanel = new JPanel();
        prodWestPanel = new JPanel();
        prodEastPanel = new JPanel();
        for (int i = 0; i < prdLabelArray.length; i++) {
            prdLabelArray[i] = new JLabel("");
        menuBar = new JMenuBar();
        fileMenu = new JMenu("File");
        optionsMenu = new JMenu("Options");
        removeMI = new JMenuItem("Remove");
        removeMI.addActionListener(this);
        exitMI = new JMenuItem("Exit");
        exitMI.addActionListener(this);
        fileMenu.add(optionsMenu);
        optionsMenu.add(removeMI);
        fileMenu.add(exitMI);
        menuBar.add(fileMenu);
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(new GridLayout(1, 0));
        prodPanel.setBackground(new Color(255, 255, 255));
        prodPanel.setLayout(new GridLayout(0, 2));
        prodWestPanel.setBackground(new Color(255, 255, 255));
        prodWestPanel.setLayout(new GridLayout(6, 0));
        prodPanel.add(prodWestPanel);
        prodEastPanel.setBackground(new Color(255, 255, 255));
        prodEastPanel.setLayout(new GridLayout(6, 0));
        prodPanel.add(prodEastPanel);
        getContentPane().add(prodPanel);
        for (int l = 0; l < prdLabelArray.length; l++) {
            if (l % 2 == 0) {
                prodWestPanel.add(prdLabelArray[l]);
                prdLabelArray[l].setHorizontalTextPosition(SwingConstants.LEFT);
            } else {
                prodEastPanel.add(prdLabelArray[l]);
                prdLabelArray[l].setHorizontalTextPosition(SwingConstants.RIGHT);
        dbc.startConnection();
        rec = dbc.selectData();
        Iterator it = rec.iterator();
        while (it.hasNext()) {
            Store_DB_Data sd = (Store_DB_Data) it.next();
            if (sd.getQDescription().equals("PROD")) {
                for (int i = 0; i < prdLabelArray.length; i++) {
                    if (prdLabelArray.getText() == "") {
prdLabelArray[i].setText(sd.getQName().toUpperCase());
break;
dbc.closeSelect();
setJMenuBar(menuBar);
setTitle("Monitor");
setSize(900, 500);
MainWindowCloser brkWindowCloser = new MainWindowCloser();
this.addWindowListener(brkWindowCloser);
setVisible(true);
pack();
public MainWindowClass(String st, String st2) {
initComponents();
public void actionPerformed(ActionEvent ae) {
Object source = ae.getSource();
if (source == exitMI) {
System.exit(0);
if (source == removeMI) {
new RemoveLabel();
class MainWindowCloser extends WindowAdapter {
public void windowClosing(WindowEvent we) {
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MainWindowClass().setVisible(true);

import java.io.Serializable;
public class Store_DB_Data implements Serializable {
    private String qName;
    private String qDescription;
    public Store_DB_Data(String qName, String qDescription) {
        this.qName = qName;
        this.qDescription = qDescription;
    public String getQName() {
        return qName;
    public String getQDescription() {
        return qDescription;
    public void setQName(String quName) {
        qName = quName;
    public void setQDescription(String quDescription) {
        qDescription = quDescription;
public class DBConnection {
    private Connection conn = null;
    private Statement stat = null;
    private ResultSet rs = null;
    public static String queueName;
    public static String description;
    public void startConnection() {
        try {
            Class.forName("com.mysql.jdbc.Driver");
            System.out.println("Registered Driver");
        } catch (ClassNotFoundException ex) {
            ex.printStackTrace();           
        try {
            String userID = "";
            String psw = "";
            String url;
            url = "jdbc:mysql://localhost:3306/mqnames";
            conn = DriverManager.getConnection(url, userID, psw);
            stat = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                    ResultSet.CONCUR_READ_ONLY);
        } catch (SQLException ex) {
            ex.printStackTrace();
    public ArrayList selectData() {
        ArrayList data = new ArrayList();
        try {
            String selectData = "SELECT queueName, description FROM testtable";
            rs = stat.executeQuery(selectData);
            while (rs.next()) {
                queueName = rs.getString("queueName");
                description = rs.getString("description");
                data.add(new Store_DB_Data(queueName, description));
        } catch (SQLException e) {
            e.printStackTrace();
        return data;
    public void closeSelect() {
        try {
            rs.close();
            stat.close();
            conn.close();
        } catch (SQLException e) {
            e.printStackTrace();
    public void deleteData(String removeName) {
        try {
            System.out.println("qName: " + removeName);
            stat = conn.createStatement();
            String deleteData = "DELETE FROM testtable WHERE queueName ='" + removeName + "'";
            int deleteCount = stat.executeUpdate(deleteData);           
            stat.close();
            conn.close();
            System.out.println("Connection for delete is closed");
        } catch (SQLException e) {
            e.printStackTrace();
    public ArrayList removeList() {
        ArrayList rData = new ArrayList();
        String names = new String();
        try {
            rs = stat.executeQuery("SELECT queueName FROM testtable");
            while (rs.next()) {
                names = rs.getString("queueName");
                System.out.println("rs: " + names);
                rData.add(new RemoveData(names));
            rs.close();
        } catch (SQLException e) {
        return rData;
}

Similar Messages

  • How do i seperate media browser from main window in Pro X

    How do i separate media browser from main window in Pro X, it only lets me drag project audio tab from main window..
    Regards
    James.

    hello, this is usually caused by adware on your pc.
    please run a scan of your system with [http://www.bleepingcomputer.com/download/adwcleaner/ adwcleaner] & also manually check that you don't have any suspicious entries like 3rd-party-toolbars presently installed under ''firefox > addons > extensions'' (adware like babylon also might install some unwanted stuff that comes under the names "Browser Manager", "Browser Protector", "Bprotector", "Object Installer", etc.) or in the windows control panel > programs section.
    afterwards install the search reset addon - it will revert the most common customziations those adware programs do in firefox back to the default: https://addons.mozilla.org/firefox/addon/searchreset/
    [[Remove a toolbar that has taken over your Firefox search or home page]]

  • How to pass values from main window to pop-up window?

    I want to pass a value from the main window (1st form) to pop-up window (2nd form). The first form is of name booking.jsp and 2nd form is of name Fund_booking.jsp. I am using window.showModalDialog to open the window. I think, I have written right code in main window to pass the value but even then I am not able to get it on pop-up window. I am not even able to display an alert on pop-up window saying "hi" by writing a function on save Button in pop-up window. The code is as follows:
    On booking.jsp:
    <script>
    function popup()
    var aForm;
    aForm = D_requisition_id.options[D_requisition_id.selectedIndex].text;
    \\Here I have captured value from a drop down box in my main window form and assigned it to the variable.
    alert(aForm);
    var myObject =new Object();
    myObject.Brandcode = aForm;
    alert(myObject.Brandcode);
    window.showModalDialog("Fund_booking.jsp",myObject,"dialogHeight:400px;dialogWidth:420px;");
    </script>
    <button name="B_FundBooking" tabIndex=4 style='POSITION:absolute;LEFT:393;TOP:292;WIDTH:100;height:24;BACKGROUND-COLOR:buttonface' onClick ="popup()">Fund Booking</button>
    On Fund_booking.jsp:
    <SCRIPT>
    var oMyObject = window.dialogArguments;
    var sBrandcode = oMyObject.Brandcode;
    alert(sBrandcode);
    </SCRIPT>
    Even the following alert is not getting displayed in pop-up window;
    <script>
    function ValidateData()
    alert("Hi");
    </script>
    <button name="B_Save" tabIndex=1 style='POSITION:absolute;LEFT:255;TOP:315;WIDTH:75;height:24;BACKGROUND-COLOR:buttonface' onClick ="ValidateData()">Save</button>
    I am using DIV instead of frames in my both forms. I just want to get that value in my pop-up window to write a query based on which data will get displayed in my table of pop-up window.
    Plz help me to solve this problem.

    Well, this is actually a JavaScript question, not a Java question but I can give some hints.
    When you do pop-up windows you need to put JavaScript in the html of the pop-up itself. Data can be passed by creating new fields in the window object, which the popup can access via the window.openner field.
    So, before invoking the popup add any data to be passed to the window object, then the onLoad function in the popup grabs the data.

  • How to pass value from main window to pop up window?

    I want to pass a value from the main window (1st form) to pop-up window (2nd form). The first form is of name booking.jsp and 2nd form is of name Fund_booking.jsp. I am using window.showModalDialog to open the window. I think, I have written right code in main window to pass the value but even then I am not able to get it on pop-up window. I am not even able to display an alert on pop-up window saying "hi" by writing a function on save Button in pop-up window. The code is as follows:
    On booking.jsp:
    <script>
    function popup()
    var aForm;
    aForm = D_requisition_id.options[D_requisition_id.selectedIndex].text;
    \\Here I have captured value from a drop down box in my main window form and assigned it to the variable.
    alert(aForm);
    var myObject =new Object();
    myObject.Brandcode = aForm;
    alert(myObject.Brandcode);
    window.showModalDialog("Fund_booking.jsp",myObject,"dialogHeight:400px;dialogWidth:420px;");
    </script>
    <button name="B_FundBooking" tabIndex=4 style='POSITION:absolute;LEFT:393;TOP:292;WIDTH:100;height:24;BACKGROUND-COLOR:buttonface' onClick ="popup()">Fund Booking</button>
    On Fund_booking.jsp:
    <SCRIPT>
    var oMyObject = window.dialogArguments;
    var sBrandcode = oMyObject.Brandcode;
    alert(sBrandcode);
    </SCRIPT>
    Even the following alert is not getting displayed in pop-up window;
    <script>
    function ValidateData()
    alert("Hi");
    </script>
    <button name="B_Save" tabIndex=1 style='POSITION:absolute;LEFT:255;TOP:315;WIDTH:75;height:24;BACKGROUND-COLOR:buttonface' onClick ="ValidateData()">Save</button>
    I am using DIV instead of frames in my both forms. I just want to get that value in my pop-up window to write a query based on which data will get displayed in my table of pop-up window.
    Plz help me to solve this problem.

    just attach the value with its url for example
    String names="java";
    <a href="# onclick="window.open('file.jsp?name='+names);"></a>

  • Mapping the data from main window to a popup

    Hi Everyone,
    Am an infant when it comes to UI5 development.
    i have been reading up as much as i can, but i need your help with a requirement analysis of mine.
    there is a main window of the UI5 screen, which has the details of a Service order.
    when the user clicks on a particular button(to create a sub service order), certain fields that are available in the main window should be automatically populated in the window that pops up.
    The UI fetches the data from an SAP r?3 backend system using  Odata protocols.
    Awaiting your valuable inputs.
    regards,
    Vamsi
    PS: am sure that this is a very basic question, it would be of gret help if any of you might share some links that will be useful for me.
    Appreciate your help very Much.

    Hi,
    You can bind multiple UI elements to the same property of the same model.
    Data Binding: Getting Started - User Interface Add-On for SAP NetWeaver - SAP Library
    If you want to reuse ui-elemnts I suggest you take a look at
    SAPUI5 SDK - Demo Kit
    Kind regards,
    RW

  • How to summarize a field from main window at the bottom

    I've a requirement in sapscript which is driven by standard program RVADOR01 to print certain quotation details.There is a field called tax code(kbetr) which
    is required to be displayed for each line item .
    Now i've also to summarize these tax code at the bottom of the page in another window.Here is the scenario
    In MAIN window:
    kbetr
      1     for 1st line item
      1     for 2nd line item
      2     for 3rd line item
      1     for 4th line item
      3     for 5th line item
      2     for 6th line item
    It have to summerise above tax code in FOOTER window as:
    kbetr
      1
      2
      3

    Hi anutosh,
    1. First check out if summary variables
       are already available in the standard drive program or not.
    2. Further to this, the TEXT ELEMENTS
      for printing the summary should also be available.
    3. This all logic / sequence of printing
       is absolutely
       contained in the driver program.
    4. If its not there,
       then probably u will have to
       copy the driver program,
       and do some enhancements/modifictiions.
    5. I don't think, by simply manipulating
       the sapscript layout, we can achieve this directly.
    regards,
    amit m.

  • How to close a window that is called from main window?

    hi....
    I have a main window that calls a second window, but when I close the second window all my application end. I just want the second window returns to main window. how do I do it?

    Set the onClose behaviour: ... something like setDefaultCloseOperation
    dont exist, instead dispose.
    In addition you could attach a listener to the windowClosing event

  • Can't Remove Album from main Window

    It's not clicked on in View Options, but iTunes 10 is insisting on putting the freaking Album/Album by Artist field all the way on the left when I don't even want to see it. Also seems to think I want to see the art work no matter what. My library is 135GB large - I have no room for freaking artwork - half of it's wrong as it is.
    Please tell me this is a bug

    Thanks - could have sworn I'd played with as many checks as I could find.

  • HTC Sense and wallpaper app has been removed from Main menu, How do you restore?

    I seem to have fat fingered the main menu, dragging, of all things the HTC Sense and Wallpaper from the main menu.  In fact,  having said that, I can no longer scroll through the menu screens that once existed.   I can get them to appear as "shadows" on the main menu, but that's it.   I have navigated to settings / applications / manage applications but have not succeeded in finding a way to reactivate the Sense and Wallpaper apps, or at least to make them reappear from where ever I dragged them to.  Before I bury myself, thought  I'd better look for help. Needless to say,  I'm new to this device and have managed to out strip my skill level in less than 2 weeks!  

    Not sure if this will work (or even how that happened) but you could try disabling sense, then turning it back on.  I think you can do this by pressing menu>settings>applications>manage applications, select the all tab at the top of your screen, scroll down to and select HTC Sense, then select clear defaults.  Then press your home button, a menu should pop up asking what action you would like to take, choose Home (or whatever the other option is besides Sense) but do not select use as default.  At this point you may want to reboot your phone then, when it comes back on, if it does not ask you again, press home button and select Sense.  If you can confirm this works, the next time you choose Sense, you can select it as default.  Kind of a shot in the dark, hope this helps.  
    Also, you may want to clear data on Sense (same place as clear defaults).  This will force you to set your homescreens and any settings or profiles you have created through Sense, but that would be my next guess.
    Oh, and if you are using a task killer, disable it.  Just throwing out ideas here.  Again, hope something here helps.

  • What can I safely remove from main Library

    Hi there,
    My MacBook Pro has a SSD drive which is almost full.
    I use it for music (Logic Pro) images (Aperture) and movies (FCP)
    I want to know what items I can safely delete from the main Libraries to free up disc space
    Thanks
    Sam

    I'm going to say "Nothing".
    OS X standard install in total is around 10GB. In addition to that, all the Logic samples and loops, which I guess you want to keep, are going to be a good few gigs.
    After that, it's your documents.

  • Smartform doesn't show preview when the records exceed the main window size

    Hi
    When i print the smart form having line items exceeding the main window size on the page it does not show the preview. The internal table loop goes into infinite loop. Is there any means whereby if the records don't fit on the main window of the page will be continued to the next page. Right now I have no clue how it is to be resolved. I feel the problem is in layout, as when i remove the main window the internal table code works fine and it does not move in infinite loop. Please help me resolve this issue.
    Thanks in advance

    Hi
    I have deleted the table from main window and instead inserted a loop.
    Also i created the two pages. But the problem still persists.
    But for my requirement my each line item in the main window has 3 lines.
    Also my layout will be the same for all pages so is there a need to create a new page.
    Is there any mechanism whereby if the line items dont fit on the mainwindow of the page will automatically continue on another page without having to define it.. please guide? Right now the smartform goes in infinite loop if it doesn't fit in main window size
    Thanks

  • How to use Two main windows with in a page in script ?

    Hi any body explain me...
    How to use Two main windows with in a page in script ?
    with  header data in one main window,
    & Item data in other main window.

    HI..,
    u need to go for <b>SPLITTING THE MAIN WINDOW</b> !!!
    Main windows in page windows allow you to format text in multiple columns. Define an area in the page window, in which to position the main windows.
    Here is the procedure !!
    -->Create a page window and assign it to a page.
    Choose <b>Edit --> Main windows</b>.
    A dialog box appears.
    -->Enter values in the fields <b>Area width</b> and A<b>rea height</b> in accordance with the input guidelines for main windows.
    -->Enter values in the fields <b>Spacing</b> and Number in the <b>Horizontal group</b> if you want to use multiple columns. You can ignore the fields in the Vertical group.
    Determine how many columns and line areas are required for label printing. Then enter the corresponding values in the fields in the <b>Horizontal and Vertical groups</b>.
    -->The value in the field Left margin varies from main window to main window if multiple columns are used. The following applies:
    <b>
    Left margin of current column + Window width + Horizontal spacing = Left margin of next column</b>
    In label printing, the field Upper margin also varies from main window to main window:
    <b>
      Upper margin of current main window +  Window height + Vertical spacing = Upper margin of next main window</b>
    -->Enter a value in the field Start position.
    This is a counter. Enter a starting value which is equal to or greater than 1.
    -->The main windows are added to the list.
    -->Save your form.
    reward if it helps u...
    sai ramesh

  • Footer of the Table in Main Window in Smartforms

    Hi,
    I have a smartform. In that I have declared a main window. And I want the Footer to appear on each page. So, I have checked both the check boxes in the Footer Event of the Table in Main Window.
    1. At page Break
    2. At end of table.
    But it is comming only on the first and last page.
    If I check only 1, it is printing on the first page only.
    If I check only 2. it is printing on the last page only.
    I want it to be printed on all the pages.
    Help needed.
    Thanks in advance.
    Ishaq.

    Hi
    Instead of using the Main window for footer
    Why can't you declare a separate constant window separately apart from MAIN window and use for the footer to print in all pages.
    create another window and write all your data in that and see
    Since MAIN window overflows as the data grows constantly it is coming only on the first and last pages.
    So to appear that on each page a fresh window is useful
    Reward points for useful Answers
    Regards
    Anji

  • Main window of SAPScript versus Main window of smartform

    Hi,
    In case of Smartform we have one main window per page but in case of SAP Script we can have 0 to 99 Main window on one page.
    In case of smartform if the main window on one page gets filled then the remaining long text will jump on main window of second page.
    Following are my doubts:
    If I define three MAIN windows for three different kind of long texts on page one in SAP Script as follows:
    MAIN Window 1 -  Long text1
    Main Window 2 -  Long text2
    Main Window 3 -  Long text3
    1) If the long text 1 on MAIN window 1 of first page gets full does it automatically jump to Main Window 2 of first page ?
    2) If I don't want the long text on Main Window 1 to jump on Main window 2 on first page but on Main winodw 1 of next page , is it possible ? How do I do it ?
    Answers will be rewarded..
    Tushar.

    In SAPScripts if the long text is filled in the Main Window it will spill over into the same Main Window if it is defined in the next page. Text from one Main Window will nt spill over onto the text to different Main window.
    So as far as you questions are concerned:
    1. Not it does not automatically jump over into Main Window 2 from Main Window 1 on same page or next page.
    2. You just need to define the Same Main Window on the next page so that text gets jumped over to the next page. If it is possible just define the next page as the same page, so that you do not have to create a separate page and attach all the windows.
    Hope this helps you...
    Shashi Reddy

  • Minimizing window in main window similar to Microsoft excel

    Hi all,
    I want to develop an application in which different windows can be opened from main window (for example 3 different graphs in different windows). Now I want the application such that whenever user minimizes any window it should minimize in its parent window rather than on windows taskbar. (Similar to Microsoft Excel where multiple excel books can me minimized or resized in excel application.
    Labview user

    This interface is known as MDI (Multiple Document Interface) and there's no native way to do it.  I haven't seen a working implementation in LabVIEW, but you can try searching this forum for MDI and see if you find one.

Maybe you are looking for

  • Slideshow - stretched image + low resolution

    Hi guys, I have a wide screen that runs at 1440x900. I have my slideshows configured not to "scale image to fit screen" as my images are in 4:3 aspect and scaling it to fit the wide screen makes everyone look fat... Viewing a quick slideshow from Fin

  • Preview can't read pdf file - what gives?

    Hello, I have just upgraded to the latest version of Mountain Lion.  In the past, I used Adobe Reader to open pdf files, but my understanding is that Preview should be able to handle this task.  For most pdf files, this is indeed the case.  However,

  • Nokia C3-01

    I just recently purchased a Nokia C3-01 and I somewhat cannot understand why the WLAN indicator above the screen disappears.  I can successfully connect to our WLAN at home and after a few minutes of browsing, the indicator would just disappear and a

  • How do i download my all my photo albums onto an external hard drive?

    How do I download all my photos from photo albums onto my hard drive??

  • New tab opens Yahoo searh page

    When I open a new tab. it opens at the yahoo search page (http://search.yahoo.com/?fr=freeze&type=W3i_NA,167,3_6,Tab%20Search,00000000,0,0,0,0). I have set my home page to blank and have made sure I have no yahoo software installed. How do I get a bl