JDialog size and components visibility

hi
I have a JDialog in which i have a panel and in the panel i have the components arranged as
Label1 Label2
Label3 TextBox1
Label4 TextBox2
Button1 Button2
I have used GridBagLayout for the panel as well as for the Dialog.The following is the code i have used to create the JDialog,panel and its components
JDialog inputdialog=new JDialog(this,true);
inputdialog.setTitle("Modify");
GridBagLayout layout=new GridBagLayout();
JPanel panel=new JPanel();
panel.setLayout(layout);
GridBagConstraints gbc = new GridBagConstraints();
JLabel key=new JLabel("Key");
gbc.gridx=0;
gbc.gridy=0;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.anchor=gbc.CENTER;
layout.setConstraints(key,gbc);
panel.add(key);
JLabel keylabel=new JLabel();
keylabel.setText("SIMPLE");
gbc.gridx=1;
gbc.gridy=0;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.anchor=gbc.NORTHWEST;
// gbc.insets=new Insets(0,0,0,200);
layout.setConstraints(keylabel,gbc);
panel.add(keylabel);
JLabel value=new JLabel("Value");
gbc.gridx=0;
gbc.gridy=1;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.anchor=gbc.CENTER;
layout.setConstraints(value,gbc);
panel.add(value);
JTextField valueTextField=new JTextField();
gbc.gridx=1;
gbc.gridy=1;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.anchor=gbc.NORTHWEST;
gbc.ipadx=100;
layout.setConstraints(valueTextField,gbc);
panel.add(valueTextField);
JLabel comment=new JLabel("Comment");
gbc.gridx=0;
gbc.gridy=2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.anchor=gbc.CENTER;
gbc.insets=new Insets(0,125,0,3);
layout.setConstraints(comment,gbc);
panel.add(comment);
JTextField commentTextField=new JTextField();
gbc.gridx=1;
gbc.gridy=2;
gbc.gridwidth=3;
gbc.gridheight=1;
gbc.ipadx=300;
gbc.insets=new Insets(0,0,0,70);
gbc.anchor=gbc.NORTHWEST;
layout.setConstraints(commentTextField,gbc);
panel.add(commentTextField);
JButton ok=new JButton("OK");
gbc.gridx=1;
gbc.gridy=3;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.ipadx=30;
gbc.ipady=10;
layout.setConstraints(ok,gbc);
panel.add(ok);
JButton cancel=new JButton("Cancel");
gbc.gridx=2;
gbc.gridy=3;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.ipadx=30;
gbc.ipady=10;
gbc.insets=new Insets(0,0, 0,150 );
layout.setConstraints(cancel, gbc);
panel.add(cancel);
inputdialog.setLayout(layout);
gbc.gridx=0;
gbc.gridy=0;
gbc.ipadx=0;
gbc.ipady=0;
gbc.anchor=gbc.FIRST_LINE_START;
gbc.insets=new Insets(80,0,900,1000);
layout.setConstraints(panel,gbc);
inputdialog.getContentPane().add(panel);
inputdialog.setSize(400,200);
inputdialog.setVisible(true);
My question is i have set the Dialog size using setSize(400,200) but when the dialog is opened the components are not visible for that size of the dialog,the components appear only when the Dialog is maximized,i do not want that to happen i want the components to appear in the Dialog when the size of the Dialog is (400,200) and not when it is maximized.What should i do?
thanks

Hopefully this example would give you some ideas:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class DialogTest extends JFrame implements ActionListener {
     public DialogTest() {
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          JButton button = new JButton("Show Dialog");
          button.addActionListener(this);
          getContentPane().add(button);
          pack();
          setLocationRelativeTo(null);
          setVisible(true);
     public void actionPerformed(ActionEvent e) {
          JDialog dialog = new JDialog(this, true);
          dialog.setTitle("Testing");
          JPanel panel = new JPanel(new GridBagLayout());
          GridBagConstraints c = new GridBagConstraints();
          JLabel label;
          JButton button;
          JTextField textField;
          label = new JLabel("Key");
          c.gridx = 0;
          c.gridy = 0;
          c.insets = new Insets(5, 10, 5, 10);
          c.anchor = GridBagConstraints.CENTER;
          c.fill = GridBagConstraints.HORIZONTAL;
          panel.add(label, c);
          label = new JLabel("SIMPLE");
          c.gridx = 1;
          c.gridy = 0;
          panel.add(label, c);
          label = new JLabel("Value");
          c.gridx = 0;
          c.gridy = 1;
          panel.add(label, c);
          label = new JLabel("Comments");
          c.gridx = 0;
          c.gridy = 2;
          panel.add(label, c);
          textField = new JTextField(10);
          c.gridx = 1;
          c.gridy = 1;
          c.gridwidth = 2;
          c.insets = new Insets(5, 10, 5, 120);
          panel.add(textField, c);
          textField = new JTextField(20);
          c.gridx = 1;
          c.gridy = 2;
          c.insets = new Insets(5, 10, 5, 10);
          panel.add(textField, c);
          button = new JButton("OK");
          c.gridx = 1;
          c.gridy = 3;
          c.ipadx = 50;
          c.gridwidth = 1;
          panel.add(button, c);
          button = new JButton("Cancel");
          c.gridx = 2;
          c.gridy = 3;
          c.insets = new Insets(5, 5, 5, 50);
          panel.add(button, c);
          dialog.getContentPane().add(panel);
          dialog.pack();
          dialog.setVisible(true);
     public static void main(String[] args) { new DialogTest(); }
}

Similar Messages

  • Logging Swing attributes like size and position from an external app

    Hello,
    I'm currently thinking about how to implement some kind of logging application which will log the JComponent properties like size, position and visibility of another running Java application.
    I want to do this to collect AOI (area of interest) data for eye-tracker based software evaluations.
    This would of course be easily accomplish-able through implementing some kind of logging directly into the application. However, I would like to log positions for gui components for any Java Swing application without having to modify it.
    So what I'm basically looking for is some way to access a running Java Application's instances. In a static way this can be done by generating a heap dump, but I need this dynamically as position, size and visibility can also alter dynamically in most applications.
    I am currently looking at the JDI-API for this purpose and have also read a bit about JMX. But I'm wondering if there is a more simple approach that I'm missing? Is there some way to do a partial heap dump for certain classes for example (programmatically)?
    I'm sorry if this is the wrong category for the posting!
    Cheers
    Dennis

    Thanks for your help on this.
    The MacBook Air is a joy; but the limited drive space is the only caveat. I really should have spent the extra money on the 256 gb flash drive; but at the time I was in the mood to go minimalist. Unfortunately that doesn't work well for me.
    I have already moved all my music to iTunes Match and moved the backups to the external drive. I also keep most of my archive data on the 3 tb external drive. It's mostly those training video programs which are about a gig each that I want to move to the external drive ... ones I would not use that often ... so it's nice to know I can do that.
    THANKS AGAIN.

  • SAP BO Dashboards 4.1 best practice on layout and components

    Dear SCN,
    I have requirement to create a BO 4.1 dashboard with data & Visualization based on a excel sheet which is currently in use as a Mgmt dashboard. The current excel dashboard is having more than 100 KPIs in one view which is readable only if you put in on a slide and view it in full screen by running a slideshow.
    Question 1:
    1. Being the suggested size of the Xcelsius canvas not more than 1024 X 768 so that it is viewable with out scroll bar in BI launchpad or in any browser or in pdf, I am trying to confirm in this forum that the canvas size of 1024 X 768 is the recommended maximum size for the dashboard to get the clear view in any browser/BI launchpad . Pls confirm as it will help me in doing the design for the KPIs and its visualization.
    Question 2:
    1. I am using the BICS connection and accessing the source data from BW. Because the no. of KPIs are more and ranging between 10 cubes and 40 queries as the data is across different modules, I would like to know what is the recommended no. of connections for queries /cubes in dashboard using BICS connectivity which does not affect the performance
    2. For the same dashboard using BICS connection, What is ideal number of components like Charts/Scorecard/Spreadsheet table that is recommended to use to ensure better performance?
    I appreciate your answers which can help the finalization of the dashboard design for this dashboard of data and visualization requirements which is very high when compared to the normal dashboards.
    Thanks and Regards
    Jana

    Hi Suman,
    Thanks for your answers.You answers and links which you have attached are helpful and It answered my questions related to canvas size and Connections.
    I am expecting some benchmark numbers as per the best practices with respect to the No. of components to be used to ensure the better loading of the dashboard. As the increase in number of components increase the size of the dashboard and also it requires more time to load the data for the components, I am looking for the number as per the best practice by considering the below points.
    1. When I say the no. of components, I am not considering the components like label, text box,combo box or list box. I am considering the components which is used for visualization and interactive drill down on top of the visualized charts ( For Eg. Column charts, Pie charts, Gauges ).
    2.I am not going to use more calculations/formulas in my dashboards as the values and structure are almost the same with the BEx query.
    3.Having around 10 to 12 connections.
    4.The data sets are not more than 900 rows totally. For any control, we will be binding only 100 rows at the max as the data for the KPIs are summarized at the year/month level at the BW layer.
    Since the KPIs are more, the Visualizations are more and we can't re-use the Visualization charts for most of the KPIs. Currently I am ending up with ~35 charts/ gauges along with other label and selection controls which I will be using to show 100 KPIs with unique visualization requirements and I am going for the tab-wise layout with more dynamic to accommodate and separate logically.
    Hope these details will give clear picture of why I am looking for the Benchmark on No. of components .
    I appreciate your help!
    Thanks and Regards
    Jana

  • Can we change font size and font type in reports

    Hi All Technical/Functional Masters,
    We are developing some transactional reports in ISU. this report has 20 columns to be printed. On screen, display is not a problem but client has a requirement to download this report in PDF format and wants to print on A4-paper in Landscape. Although we have managed to accommodate all the columns on A4 paper but have to compromise with font size that are very small and not visible. If we download the report in excel format we are able to maintain the font size 8 and accommodate all columns after little format but same in PDF is a problem.
    Can anyone tell whether we can increase the font size and change font type(from SAP standard to 'Arial') before sending the output in PDF ? Is there any property or utility that can be changed or used for this purpose.

    Function Module : CONVERT_ABAPSPOOLJOB_2_PDF
    Include : THSTXWFPL
      for modify font size
    decrease fontsze foncharacter will increase
    fontsize = 120.     <-- Change
    fontsize = 100.  or fontsize = 80
    Depend on your logon lang. My case logon 'TH' or 2.  I modified font ZCORDIA (refer CordiaNEW thai font)
    if is_cascading is initial.
      case language.
      when '0'. "Serbian
        font = 'COURCYR'.  devtype = 'SAPWIN'.
      when '1'. "simpl.Chinese
        font = 'CNHEI'.    devtype = 'CNSAPWIN'. cjklang = 'X'.
      when '2'. "Thai
      font = 'THDRAFT'.  devtype = 'THPDF'.
       font = 'ZCORDIA'.  devtype = 'ZMTHSWNU'.
        font = 'THANGSAN'.  devtype = 'ZPDFUC'.
      when '3'. "Korean
        font = 'KPSAMMUL'. devtype = 'KPSAPWIN'. cjklang = 'X'.
      when '4'. "Romanian
        font = 'COURIER'.  devtype = 'I2SWIN'.
      when '5'. "Slovenian
        font = 'COURIER'.  devtype = 'I2SWIN'.
      when '6'. "Croatian
        font = 'COURIER'.  devtype = 'I2SWIN'.
      when '8'. "Ukranian
        font = 'COURCYR'.  devtype = 'SAPWIN'.
    Add font Cordia Thai
    SE73 --> Fon familia --> ZCORDIA
    Load Font Cordia thai to system
    SE38 --> RSTXPDF2UC
    load CORDIA.TTF
    SE73 --> printer font --> 'ZMTHSWNU'
    Add ZCORDIA font and copy AFM Metric from = 'THDRAFT'.  devtype = 'THPDF'.
    Modify AFM
    example
    *----- OLD--
    StartFontMetrics 2.0
    sapFamily ZCORDIA
    sapHeight 000
    sapBold false
    sapItalic false
    StartCharMetrics 0183
    WX 0500 ; N space                          ;
    WX 0500 ; N exclam                         ;
    WX 0500 ; N quotedbl                       ;
    WX 0500 ; N numbersign                     ;
    WX 0500 ; N dollar                         ;
    WX 0500 ; N percent                        ;
    WX 0500 ; N ampersand                      ;
    *--NEW--
    StartFontMetrics 2.0
    sapFamily ZCORDIA
    sapHeight 000
    sapBold false
    sapItalic false
    StartCharMetrics 0183
    WX 0375 ; N space                          ;
    WX 0375 ; N exclam                         ;
    WX 0375 ; N quotedbl                       ;
    WX 0375 ; N numbersign                     ;
    WX 0375 ; N dollar                         ;
    WX 0375 ; N percent                        ;
    WX 0375 ; N ampersand                      ;
    Result : decrease space between character.   Then Your PDF will have BIGGER FONT.
    Rdgs,
    Suwatchai

  • Menu size and button viewing

    I've been using FCS2 for quite awhile with no problem with DVDSP. I had to clean install my system, so decided to upgrade to the latest versions, which for DVDSP was 4.2.1. (OS 10.5.2 at the time)
    When I opened the new version of DVDSP for the first time, the layout was a little different, which I can live with. What I am having trouble with is the viewing of the menu. It is quite a bit smaller ( on a 30" monitor it is about 4x6 inches in size) and I can't increase the viewing size at all.
    I make my menus in photoshop. When I try to draw buttons, the buttons used to stay on the screen so when I drew a second button I would know where the first one was so as not to overlap. Not so now. The other buttons are not visible, although if I click on the word where I have made a button that particular button will come back up (only that button, though).
    I need to make the viewing size larger and see all the buttons at once that I have drawn. Is this possible in vs 4.2.1? It used to be in previous versions.
    Thanks.
    Sharon

    There are three viewing modes for DVDSP - basic, intermediate and advanced. You can switch between them at any time using the apple key on your keyboard and either the number 1, 2 or 3. For access to all of the features, use the advanced mode.
    When the app opens in this mode there are four distinct 'quarters' to the display. You can use your mouse to get the pointer in the border between each section and simply drag to widen the display of that section. As you do, a corresponding section will reduce in size. If you click on the intersection of the four quarters and drag that then you can re-size all four at once.
    Menu display will not get very large at all, but you can click on the menu viewer tab within it's quarter and drag it 'out' of the quarter to be in its own window that floats above the other quarters. You can then use two monitors and drag the menu viewer onto a second screen, which, if you change the resolution, will appear larger.
    In this respect DVDSP has remained the same since version 3.

  • Icon size and spacing keeps changing to miniscule size

    I keep running into the situation when I open a finder window, the icon size and spacing shifts from what I have set as a default.  I have a specific icon size of 64 that i use and the spacing is close together.  Every now and then, the icons are so tiny as to not be legible and spacing changes to 2 inches between icons.  No matter how many times I change the show view options they do not stay.  Why does this happen and not stay as I want??

    Try deleting the com.apple.finder.plist.
    Hold down the option key while using the Finder “Go To Folder” command. Enter ~/Library/Preferences/com.apple.finder.plist.  Move the .plist to your desktop.
    Relaunch Finder ( Command-option-esc, select Finder and Force quit) . If it works okay, delete the plist(s) from the desktop.
    If the same, return the .plist to where you got them from, overwriting the newer ones.
    If you prefer to make your user library permanently visible, use the Terminal command found below.
    http://osxdaily.com/2011/07/04/show-library-directory-in-mac-os-x-lion/
    You might want to bookmark the command. I had to use it again after I installed 10.8.4. I have also been informed that if you drag the user library to Finder it will remain visible.

  • How to check image size and 500PX upload action please!

    Hi,
    Two questions please.
    1. How do you check the overall size of an image in Lightroom 4 before exporting.  In Photoshop it is image/size so what is it in Lightroom please?
    2. I have Canon raw files and tiffs and want to upload to 500PX and other web site galleries in one action.  Is it possible?  How do you set up an action to convert an image, say a tiff, to a certain size and then save as a jpeg and upload to 500pX using the plugin all in one action?  At the moment I am saving the tiff as a jpeg to a correct size using a pre set, but then exporting to another folder ready to either manually upload or re-import to Lightroom as a jpeg then upload. Surely there is a quicker way than this?

    1. The size is visible in the metadata panel, set the dropdown to EXIF. In addition, in the Grid, with Ctrl-J, you can set the options so that you will see the cropped size in the rectangle surrounding the photo.
    2. You cannot, in one action, upload to multiple galleries. Each upload is its own action. I don't know if there is a plug-in to let you upload from LR to 500px in one action; clearly there are plug-ins for Flickr and Smugmug and several others. There should be no need to re-import. Normally, the plug-ins I mentioned will take a TIFF, resize it according to your directions, convert to JPG and upload.

  • How u will set the external parameters like packet size and number

    How u will set the external parameters like packet size and number of parallel process.

    Dear Karthik,
    <b>ALE:</b>    
    Use Transaction UPSC02         -      ALE Distribution Unit: Packet Types.
    Performance Optimization for <b>ODS</b> Objects:
    To ensure a good ODS object loading performance, take the following into account:
           1.      Creating SIDs
    The creation of SIDs takes a long time and can be avoided in the following cases by:
           Not setting the indicator for BEx Reporting if you are using the ODS object only as a data store. If you do set this indicator, SIDs are created for all new characteristic values.
           If you use line items (for example, document number or time stamp) as characteristics in the ODS object, in the characteristic maintenance, indicate these as Attribute Only.
    SIDs are created in parallel if <b>parallel activation</b> is switched on (see last point). They are then created with the same number of parallel processes as created for the activation.
    However, if you specify a server group or a special server in customizing, these specifications are not only valid for the activation, but also for the SID creation. The creation of SIDs runs on the application server on which the batch job also runs.
           2.      DB partitioning in active data tables (technical A table)
    By partitioning by database level, you can delete data from the ODS object much more quickly. As a partitioning criterion, choose the characteristic by which you want to delete.  For more information on partitioning database tables, see the database documentation (DBMS-CD). Partitioning is supported by the following databases: Oracle, DB2/390, Informix.
           3.      Indexing
    Use selection criteria for queries for ODS objects. If the key fields are specified, the existing primary index is used. The more frequently accessed characteristic should appear on the left-hand side.
    If you did not specify the key fields completely in the selection criteria (visible in the SQL trace), you improve the run time of the query by creating additional indexes. You can create these secondary indexes in the ODS object maintenance.
           4.      Activation of data in an ODS object
    To improve system performance when activating data in the ODS object, you can make the following entries in Customizing under SAP Customizing Implementation Guide -> SAP NetWeaver -> Business Information Warehouse -> General BW Settings ->  ODS Object Settings:
           the maximum number of parallel processes when activating data in the ODS object as when moving SIDs
           the minimum number of data records for each data package when activating data in the ODS object, meaning you define the size of the data packages that are activated
           the maximum wait time in seconds when activating data in the ODS object. This is the time when the main process (batch process) waits for the dialog process that is split before it classifies it as having failed.
           the server group that needs to be used when activating the data in ODS objects in parallel You have to create the server groups beforehand using the following path: Tools -> Administration -> Network -> RFC Destination, RFC -> RFC Groups. If you do not specify anything here, then the activation runs on the server on which the batch process was started for activation. If a server from the server group is not active, then the activation is cancelled.
           5.      Loading unique data records
    If you only load unique data records (meaning data records with nonrecurring key combinations) into the ODS object, then the loading performance is improved when you set the indicator Unique Data Records in the ODS object maintenance.
    The records are then updated more quickly because the system no longer needs to check whether the record already exists. You do have to be sure that there duplicate records are definitely not being loaded, because this will lead to termination.
    Regards,
    Naveen.

  • Scenegraph size and speed of the application

    Hello all,
    I have seen that my application becomes slower (responding to events)as the size of scenegraph increases. I am binding my components width and height to scene width and height.
    Say, for example when the width and height is 800 x 500 it is faster and components like ListView respond quickly to MouseClicked or KeyTyped events smoothly. As I maximize the application I see there is some lag for the same behaviour.
    Is it one of the best practices to keep scenegraph smaller? I noticed demo apps on JavaFX website are also smaller ?
    thanks for your input
    yosoh.

    Somehow related to [Bad resolution on big size|http://forums.sun.com/thread.jspa?threadID=5442393] thread...
    Given all the DLLs (on Windows) found in the JavaFX SDK, one could think JavaFX makes the best of graphics acceleration, but possibly it still relies a lot on Java2D which is slow (although can be backed by a hardware pipeline, no?), at least comparatively to hardware acceleration.
    Now, the glitches we see in the sample code referenced above might come from garbage collection pauses, a common problem in Java...
    Anyway, I hope the Prism toolkit which is largely based on graphics card and not relying on Java2D will allow better performances.

  • Default size and location, dialog boxes

    how can I set default size and location of dialog boxes? I have tried several things to no avail,
    thanks in advance

    1. You could create your own subclass of Dialog/JDialog with your defaults set automatically
    2. You could create a DialogFactory that creates Dialogs (pretty much the same as 1)

  • Defining non-Component objects with size and location using Swing

    I am attempting to write a program which will be able to manipulate (display, move, resize) objects in a Swing window which are not necessarily components. These "Window"s are defined by a Window interface which defines a Window as any object which has a size and a location (effectively a rectangular area). This would ideally allow me to perform operations such as drawing an arbitrary picture on a Jpanel, for example, wrap that drawing in a rectangular area, and then be able to resize it/move it about as a separate panel. In order to do this I believe I would have to override the paint() method, although I'm not completely sure. If anyone has any suggestions of a proper way to override the method or know a proper way to attack this problem, I would greatly appreciate it.
    Thanks,
    Adrian

    It's hard to say since it's not quite clear what you're doing but:
    1) if these objects are not necessarily components, that's fine, but you're not trying to add them to the basic GUI framework, are you? If you want to do something like this, then probably the best thing is to have a particular component that knows how to handle these objects, and then have a clean separation between components and non-components at that level. So this component would maintain and display a collection of those non-component objects, but no other component would be expected to know anything about them, and the non-component objects wouldn't know about any components at all.
    2) it might be helpful to give all the non-component objects a method that looks like this:
    void drawSelf(Graphics g);and that this method would tell the object to draw itself on that Graphics object. The object might also have an "offset" value, essentially an x,y position, and it would draw itself relative to that position.

  • Object Size and Position values not being retained

    Hi,
           I'm trying to set the size and position of a picture object in a report. This logo, should appear on the top right corner of the report.
    The margins of the report are Left - .79 in, Right - 0.79 in, Top - 0.79 in and Bottom - 0.39 in.
    The size of the picture object should be 1.574 x 0.79 inches.
    I have ensured that File -> Page Setup -> dimensions are in INCHES.
    I right click the logo and select 'Size and Position'.
    I set 'Y' (distance between top of object and top margin) = 0. This is to perfectly align the object with the top margin.
    Now, i set the height of the object = 0.79 inches. Ok the dialog and close.
    The strange thing happening is, when i re-open the size and position dialog, i see that the values i set are not being retained.
    0.79 becomes 0.810
    and
    0 become -0.010.
    What am i doing wrong here? How can i make sure the values i specify in the size and position dialog are  retained.
    Thanks.

    Ensure File | Options | Layout tab has the following UNMARKED!!!!
    Design View
      Guidelines
      Grid
    Preview
      Guidelines
      Grid
    Ensure that "Snap to Grid" is turned off.
    Make your grid size larger (.5 inches for example)
    What is occurring (I suspect) is that your objects are snapping to the grid - thus changing the position and possibly size due to the Snap to Grid being turned on.

  • Detecting a JDialog opening and closing

    Hey everyone,
    This is a simple question, or at least, it should be :). I need a Timer to start when a JDialog opens and stop when it closes so a cute icon animation shows.
    So far, I managed to detect when the window opens, but not when it closes. This code is at the JDialog constructor:
    addWindowListener(new WindowAdapter()
                @Override
                public void windowClosed(WindowEvent we)
                    System.out.println("\t\t\t\twindowClosed");
                    busyIconTimer.stop();
                @Override
                public void windowOpened(WindowEvent we)
                    System.out.println("\t\t\t\twindowOpened");
                    busyIconTimer.start();
            });When I call "setVisible(true)", the windowClosed event is raised.
    When I call "setVisible(false", no event is called whatsoever (tried all the events available).
    Instead, if I call "mydialog.dispose()", the windowClosed event is called correctly.
    But after this, if I call "setVisible(true)" again, the windowOpened isn't called.
    Can anyone help me? :)
    Thanks in advance.

    I find that setVisible(false) calls windowDeactivate:
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowEvent;
    import java.awt.event.WindowListener;
    import javax.swing.JButton;
    import javax.swing.JDialog;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    public class DialogStateListener
      private static void createAndShowUI()
        final JFrame frame = new JFrame("DialogStateListener");
        final JDialog dialog = new JDialog(frame, "Dialog", true);   
        JButton showDialogBtn = new JButton("Show Dialog");
        showDialogBtn.addActionListener(new ActionListener()
          public void actionPerformed(ActionEvent e)
            dialog.setVisible(true);
        frame.getContentPane().add(showDialogBtn);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
        JButton setVisibleFalseBtn = new JButton("setVisible(false)");
        JButton disposeBtn = new JButton("dispose");
        setVisibleFalseBtn.addActionListener(new ActionListener()
          public void actionPerformed(ActionEvent e)
            dialog.setVisible(false);
        disposeBtn.addActionListener(new ActionListener()
          public void actionPerformed(ActionEvent e)
            dialog.dispose();
        dialog.setPreferredSize(new Dimension(200, 200));
        JPanel contentPane = (JPanel)dialog.getContentPane();
        contentPane.setLayout(new FlowLayout());
        contentPane.add(setVisibleFalseBtn);
        contentPane.add(disposeBtn);
        dialog.pack();
        dialog.setLocationRelativeTo(null);
        dialog.addWindowListener(new WindowListener()
          public void windowActivated(WindowEvent e)
            System.out.println("window activated");
          @Override
          public void windowClosed(WindowEvent e)
            System.out.println("window closed");
          @Override
          public void windowClosing(WindowEvent e)
            System.out.println("window closing");
          @Override
          public void windowDeactivated(WindowEvent e)
            System.out.println("window deactivated");
          @Override
          public void windowDeiconified(WindowEvent e)
            System.out.println("window deiconified");
          @Override
          public void windowIconified(WindowEvent e)
            System.out.println("window iconified");
          @Override
          public void windowOpened(WindowEvent e)
            System.out.println("window opened");
      public static void main(String[] args)
        java.awt.EventQueue.invokeLater(new Runnable()
          public void run()
            createAndShowUI();
    }

  • How to change font size and window size for a pop-up Message Window?

    Hello,
    I am trying to display a very important message to alert our tester or any user when there is an emergency and they have to stop the test they are doing. I really desire to use larger message window/fonts to do this.
    I have tried Display Message To User and converted it to SubVI, but no luck yet. I thought SubVI might work. But when it's displayed, the original Pop-up Message Window sat right on the SubVI panel. When I then clicked OK to close the Message Window, it closed the SubVI panel as well.
    Are Text Indicator and its Visible Node the only way to make this happen? If yes, could someone teach me how to pause the program execution like Display Message To User when the program is waiting for user to click OK to continue?
    Thanks So Much!
    Shun

    Hello,
    Why don't you create your own vi and customize it.
    See the attached example made for you
    Software developer
    www.mcm-electronics.com
    PS: Don't forget to rate a good anwser ; )
    Currently using Labview 2011
    PORTUGAL
    Attachments:
    Main4.vi ‏7 KB
    messagebox.vi ‏15 KB

  • Report page scaling/zoom for paper size and field width?

    Are there ways to design a report, or programmatically set a report to dynamically resize based on factors such as paper size (A4 vs. Letter vs. Legal), orientation (portrait vs. landscape), and field width (e.g fields grow and shrink based on data)?  We are looking at ways to dynamically choose paper size and scale.  This would be similar to how Excel files can adjust for printing depending on paper, and PDF files can zoom in/out for paper size.
    Thanks,
    Kyle

    We don't want to add fields dynamically at runtime.  Instead we want to automatically resize fields at runtime to properly fit data on the page.  Currently with our 400 reports, data fields have gotten longer over the years so important data is being truncated.  We'd like it if fields could properly grow/shrink/scale so that the data is always valid.  We'd like it if the user flips from portrait to landscape, the field widths automatically grow to use the entire page.  Or, if a user goes from Letter to A4, pagination still works properly and the fields get slightly wider to fit the A4 standard.
    What we don't want is to have a version of the report for portrait Letter, portrait A4, portrait Legal, landscape Letter, landscape A4, landscape Legal, etc.  It would be a support nightmare.
    I don't know if it is possible, but I'm hoping it is.  Thanks for the help.
    Kyle

Maybe you are looking for