JLabel dimension question

Hi,
I have a need to automatically set the preferred height of a JLabel based on a given width.
Normally, if you call setPreferredSize(null), the JLabel will automatically adjust its preferred size to fit the text it has. What I want is to have this functionality, but only for the height, while being able to set the width. I have a multi-line JLabel using HTML, and I wish there was something like a setPreferredWidth(int) function that would allow me to fix the width but have the JLabel automatically fit the height.
Does this functionality exist anywhere? If not, is there a simple workaround? I mean I could create my own component that does this but it would be a huge pain especially if Swing has a method somewhere that implements this functionality.
Thanks,
-Mike

perhaps you could dummy-up a textArea to simulate a label the way you want
something like this
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Testing
  JTextArea[] ta = new JTextArea[3];
  public void buildGUI()
    JPanel p = new JPanel();
    for(int x = 0; x < ta.length; x++)
      ta[x] = new JTextArea();
      ta[x].setColumns(10);
      ta[x].setBorder(null);
      ta[x].setFocusable(false);
      ta[x].setLineWrap(true);
      ta[x].setWrapStyleWord(true);
      ta[x].setOpaque(false);
      p.add(ta[x]);
    ta[0].setText("I have a need to automatically set the preferred height"+
                                     " of a JLabel based on a given width.");
    ta[1].setText("Normally, if you call setPreferredSize(null), the JLabel"+
    " will automatically adjust its preferred size to fit the text it has. "+
    "What I want is to have this functionality, but only for the height,"+
    " while being able to set the width.");
    ta[2].setText("I have a multi-line JLabel using HTML, and I wish there was"+
    " something like a setPreferredWidth(int) function that would allow me to "+
    "fix the width but have the JLabel automatically fit the height.\n"+
    "Does this functionality exist anywhere? If not, is there a simple workaround?"+
    " I mean I could create my own component that does this but it would be a "+
    "huge pain especially if Swing has a method somewhere that implements this functionality.");
    JFrame f = new JFrame();
    f.getContentPane().add(p);
    f.setSize(600,500);
    f.setLocationRelativeTo(null);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setVisible(true);
  public static void main(String[] args)
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        new Testing().buildGUI();
}

Similar Messages

  • A few simple (?) dimension questions...

    Hi, I have a few really simple dimension questions that I just can't figure out in OWB (which I'm just now starting to play with):
    1) I'm trying to create a dimension that has no levels or any hierarchy. In the BI tool, I just want this dimension to act as a "pick list" for one of 8 values (DW data snapshot dates for the last 8 weeks...) Users won't summarize by this dimension, or ever have more than 1 week selected at a time. How can I set this type of dimension up?
    2) Somewhat related to #1 - just to get something working, I set up a "time in weeks" dimension not as a time dimension, just as a normal user dimension. I then added a single "weeks" level with a surrogate key (using "key" instead of "id"), short desc (as the business key), and long description. Set up a mapping from my source table, everything worked fine. The strange thing I've notcied is that the relational table produced has both a "week_key" column and a "dimension_key" column. How can I get rid of the "dimension_key" column - its just an exact duplicate of the lowest level key column? Note - we will have a dimension table with over 1.3 BILLION rows in our warehouse - so duplicating this column does add a significant amount of overhead - this isn't just an academic problem.
    3) related to building this "test" dimension - my source table has 8 records in it. Whenever I run the ETL to populate the dimension table, the surrogate keys end up being key values 9 - 16 instead of 1 - 8. Note this is even if I reset the sequence number to 1 before I start, etc. My understanding is that Oracle uses a variable width number field when storing data - so having this dimension with values 1-8 instead of 9-16 saves approx a byte for every fact table record (which we're predicting will be in the range of 20 - 50 BILLION rows). How can I force the dimension to start numbering at 1?
    Thanks in advance,
    Scott

    Hi
    Reg #2, I do not think we can get rid of the "dimension key". It looks like OWB is creating this column as a default Primary Key and hence is not possible to remove this. May be if we build the base Table for dimension as a normal relational table, which will allow us to define our own keys, and then build the "Dimension" using AWM on this relation table may resolve the issue of having duplicate primary keys. Its only a thougt, have not tested though.
    rgds
    Mahesh

  • SampleSales.RPD Customer Dimension Questions

    Hello, I am trying to figure out how SampleSale.rpd was built. I am stepping through data element from the physical layer all the way to the presentation layer and am confused about the following:
    Question for "Sample Sales" section
    - When i expand "H1 Customer Dimension", i see "Total" level and a number of revenue / qty members listed under it. I trace them back to physical layer fact columns and i also see them present in the presentation layer fact section. However, how can i get this attribute (which looks like a fact attribute) to show up under "h1 customer --> Total" level? I see the formula to for each but i am confused how to get this into inside the dimension.
    Any help is greatly appreciated.
    Regards,

    You leave them in place in the Logical Fact.
    What you see at the dimension levels are just UI "pointers" to the Logical Fact columns, you can set level based measures manually in the content tab of that measure if you dont fancy dragging (or scrolling) up to the dimension levels themselves.
    P.s Suggest you use a splitter in the fact table, just like Sample Sales to make it easy on the eye. Typical splits might be :
    -----Measures------
    a
    b
    c
    ---- Time Based----
    a MAGO,
    a YAGO,
    b MAGO,
    b YAGO
    ---- Level Based----
    a (Year)
    a (Channel)
    etc etc.
    --- Derived----
    Profit %
    Profit £
    You can then choose to expose the splitte in the presentation catalog, or use nested Fact tables with appropriate names (see "nesting presentation tables")
    Hope this helps !

  • JLabel/html question

    how do you make a tab in html within a JLabel text.
    also how do you get rid of the bold that seems to be on every J label?

    Thanks Kel, I'm not using metal, but maybe that third line should do what I want?
    and Quack, I do whole heartedly agree with you, but this is something that I HAVE to finish by tomorrow. Considering I had quite a good bit more to do, and the way that I have done it seems to work just fine, I decided to leave it as is. If I finish with enough time, I will likely go back and implement that cardLayout like you suggested.
    Although I am curious, what is wrong specifically with how I have done it? (As for how the GUI components are changed)
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.text.*;
    import java.util.*;
    public class Holder extends JFrame implements ActionListener
        static Scanner scan;
        static int returnFileVal;
        static int index;
        static int totalEmployees;
        static double grossPayCalc;
        static double totalGross;
        static double totalFICA;
        static double totalFED;
        static double totalInsur;
        static double totalNet;
        static String data;
        static String totals;
        static File file;
        static ArrayList TermCode = new ArrayList();
        static ArrayList EmpID = new ArrayList();
        static ArrayList FName = new ArrayList();
        static ArrayList MName = new ArrayList();
        static ArrayList LName = new ArrayList();
        static ArrayList Suffix = new ArrayList();
        static ArrayList HourRT = new ArrayList();
        static ArrayList HourWK = new ArrayList();
        static ArrayList Dep = new ArrayList();
        static ArrayList Insur = new ArrayList();
        static ArrayList YTDGR = new ArrayList();
        static ArrayList YTDFICA = new ArrayList();
        static ArrayList YTDFED = new ArrayList();
        static ArrayList grossPay = new ArrayList();
        static ArrayList FICA = new ArrayList();
        static ArrayList FED = new ArrayList();
        static ArrayList netPay = new ArrayList();
        static ArrayList dataList = new ArrayList();
        static Holder f;
        static Container c;
        static JPanel homePanel = new JPanel();
        static JPanel firstRow = new JPanel();
        static JPanel secondRow = new JPanel();
        static JPanel thirdRow = new JPanel();
        static JPanel fourthRow = new JPanel();
        static JPanel fifthRow = new JPanel();
        static JPanel sixthRow = new JPanel();
        static JPanel seventhRow = new JPanel();
        static JPanel eighthRow = new JPanel();
        static JPanel ninthRow = new JPanel();
        static JLabel hoursWorkedLabel = new JLabel("Default hours worked:");
        static JTextField hoursWorkedField = new JTextField("40",2);
        static JButton processButton = new JButton ("Process payroll for all non-terminated employees");  
        static JButton closeButton = new JButton ("End Program");
        static JLabel chooseFileLabel = new JLabel("Select the payroll file");
        static JFileChooser fc = new JFileChooser();
        static JPanel filePanel = new JPanel();
        static JTextField fileChooseField = new JTextField(25);
        static JButton fileChooseButton = new JButton("Find");
        static JButton fileOKButton = new JButton("Process");
        static JButton fileBackButton = new JButton ("Back");
        static JPanel processPanel = new JPanel();
        static JLabel pleaseSelectLabel = new JLabel("Please select an option.");
        static JButton payrollJournalButton = new JButton("View the payroll journal");
        static JButton checkButton = new JButton ("View the checks");
        static JButton checkStubButton = new JButton ("View the check stubs");
        static JLabel payrollJournalTitle = new JLabel("<html><b><u>Payroll Journal</u></b></html>");
        static JButton payrollBack = new JButton("Back");
        static JPanel payrollPanel = new JPanel();
        static JList payrollList = new JList();
        static JLabel payrollEmployeeData = new JLabel();
        static JLabel payrollSubtitles = new JLabel ("EmpID\t\tName\t\tGross Pay\t\tFICA\t\tFED\t\tInsur\t\tNet Pay");
        static JLabel payrollTotals = new JLabel();
        static JScrollPane payrollScroll = new JScrollPane();
        public static void main(String[] args)
            f = new Holder();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setSize(450,300);
            f.setTitle("Payroll");
            f.setResizable(false);
            f.setLocation(200,200);
            f.setVisible(true);
            createHome();
        public Holder()
            c = getContentPane();
        public void actionPerformed(ActionEvent e)
        public static void createHome()
            firstRow.removeAll();
            secondRow.removeAll();
            thirdRow.removeAll();
            homePanel.removeAll();
            homePanel.setLayout(new GridLayout(3,1));
            FlowLayout rowSetup = new FlowLayout(FlowLayout.CENTER);
                firstRow.setLayout(rowSetup);
                secondRow.setLayout(rowSetup);
                thirdRow.setLayout(rowSetup);
            firstRow.add(hoursWorkedLabel);
            firstRow.add(hoursWorkedField);
            secondRow.add(processButton);
            thirdRow.add(closeButton);
            homePanel.add(firstRow);
            homePanel.add(secondRow);
            homePanel.add(thirdRow);
            closeButton.addActionListener(new endProgram());
            processButton.addActionListener(new processPayroll());
            c.remove(filePanel);
            c.add(homePanel);
            c.validate();
            c.repaint();
        public static void createPayroll()
            filePanel.removeAll();
            filePanel.setLayout(new GridLayout(3,1));
            FlowLayout rowSetup = new FlowLayout(FlowLayout.CENTER);
                firstRow.setLayout(rowSetup);
                secondRow.setLayout(rowSetup);
            firstRow.removeAll();
            secondRow.removeAll();
            thirdRow.removeAll();
            fileChooseButton.addActionListener(new fileChooser());
            fileBackButton.addActionListener(new fileBack());
            fileOKButton.addActionListener(new processFinal());
            firstRow.add(chooseFileLabel);
            secondRow.add(fileChooseField);
            secondRow.add(fileChooseButton);
            thirdRow.add(fileBackButton);
            thirdRow.add(fileOKButton);
            filePanel.add(firstRow);
            filePanel.add(secondRow);
            filePanel.add(thirdRow);
            c.remove(homePanel);
            c.add(filePanel);
            c.validate();
            c.repaint();
        public static void processFinal()
            try
                scan = new Scanner(new BufferedReader(new FileReader(file)));
            catch(IOException io)
                System.out.println("The file cannot be opened");
            scan.useDelimiter(",");
            index = 1;
            totalEmployees = 0;
           while (scan.hasNext())
               int type = index%13;
               switch (type)
                    case 1: TermCode.add(scan.next());
                            totalEmployees++;
                            break;
                    case 2: EmpID.add(new Integer(scan.next()));
                            break;
                    case 3: FName.add(scan.next());
                            break;
                    case 4: MName.add(scan.next());
                            break;
                    case 5: LName.add(scan.next());
                            break;
                    case 6: Suffix.add(scan.next());
                            break;
                    case 7: HourRT.add(new Double(scan.next()));
                            break;
                    case 8: HourWK.add(new Integer(scan.next()));
                            break;
                    case 9: Dep.add(new Integer(scan.next()));
                            break;
                    case 10:Insur.add(new Double(scan.next()));
                            break;
                    case 11:YTDGR.add(new Double(scan.next()));
                            break;
                    case 12:YTDFICA.add(new Double(scan.next()));
                            break;
                    case 0: YTDFED.add(new Double(scan.next()));
                            break;
                index++;
            for (index = 0; index < totalEmployees; index++)
                if ((Integer)HourWK.get(index) > 40)
                    grossPayCalc = (((Integer)HourWK.get(index)-40)*(Double)HourRT.get(index)*1.5);
                    grossPayCalc += (40*(Double)HourRT.get(index));
                else
                    grossPayCalc = ((Integer)HourWK.get(index)*(Double)HourRT.get(index));
                grossPay.add(grossPayCalc);
                FICA.add((Double)grossPay.get(index)*.0765);
                FED.add((290-65*(Integer)Dep.get(index))*.15);
                netPay.add((Double)grossPay.get(index)-((Double)FICA.get(index)+(Double)FED.get(index)+(Double)Insur.get(index)));
            firstRow.removeAll();
            secondRow.removeAll();
            thirdRow.removeAll();
            c.remove(filePanel);
            processPanel.setLayout(new GridLayout(4,1));
            FlowLayout rowSetup = new FlowLayout(FlowLayout.CENTER);
                firstRow.setLayout(rowSetup);
                secondRow.setLayout(rowSetup);
                thirdRow.setLayout(rowSetup);
                fourthRow.setLayout(rowSetup);
            firstRow.add(pleaseSelectLabel);
            secondRow.add(payrollJournalButton);
            thirdRow.add(checkButton);
            fourthRow.add(checkStubButton);
            payrollJournalButton.addActionListener(new viewJournal());
            processPanel.add(firstRow);
            processPanel.add(secondRow);
            processPanel.add(thirdRow);
            processPanel.add(fourthRow);
            c.add(processPanel);
            c.validate();
            c.repaint();
        public static void createFileChooser    ()
            returnFileVal = fc.showOpenDialog(filePanel);
            if (returnFileVal == JFileChooser.APPROVE_OPTION)
                file = fc.getSelectedFile();
            fileChooseField.setText(file.toString());
        public static void createJournal()
            f.setSize(700,500);
            firstRow.removeAll();
            secondRow.removeAll();
            thirdRow.removeAll();
            fourthRow.removeAll();
            c.remove(processPanel);
            payrollPanel.setLayout(new GridLayout(9,1));
            FlowLayout rowSetup = new FlowLayout(FlowLayout.CENTER);
                firstRow.setLayout(rowSetup);
                secondRow.setLayout(rowSetup);
                thirdRow.setLayout(rowSetup);
                fourthRow.setLayout(rowSetup);
                fifthRow.setLayout(rowSetup);
                sixthRow.setLayout(rowSetup);
                seventhRow.setLayout(rowSetup);
                eighthRow.setLayout(rowSetup);
                ninthRow.setLayout(rowSetup);
           data = new String("<html>");
           for (index = 0; index < totalEmployees; index++)
               data += (Integer)EmpID.get(index);
               data += "\t\t";
               data += ((String)FName.get(index) + " ");
               if (((String)MName.get(index)).equals(" ")==false)
                   data += ((String)MName.get(index) + ". ");
               data += ((String)LName.get(index) + " ");
               data += (String)Suffix.get(index);
               data += "\t\t";
               data += (Double)grossPay.get(index);
               data += "\t\t";
               data += (Double)FICA.get(index);
               data += "\t\t";
               data += (Double)FED.get(index);
               data += "\t\t";
               data += (Double)Insur.get(index);
               data += "\t\t";
               data += (Double)netPay.get(index);
               data += "</br>";
           data += "</html>";
           for (index = 0; index < totalEmployees; index++)
               totalGross += (Double)grossPay.get(index);
               totalFICA += (Double)FICA.get(index);
               totalFED += (Double)FED.get(index);
               totalInsur += (Double)Insur.get(index);
               totalNet += (Double)netPay.get(index);
           totals = new String ("Final Totals\t\t\t\t" + totalGross + "\t\t" + totalFICA + "\t\t" + totalFED + "\t\t" + totalInsur + "\t\t" + totalNet);
           payrollTotals.setText(totals);
           payrollEmployeeData.setText(data);
           firstRow.add(payrollBack);
           payrollBack.addActionListener(new processPayroll());
           secondRow.add(payrollJournalTitle);
           fourthRow.add(payrollSubtitles);
           fifthRow.add(payrollEmployeeData);
           eighthRow.add(payrollTotals);
           payrollPanel.add(firstRow);
           payrollPanel.add(secondRow);
           payrollPanel.add(thirdRow);
           payrollPanel.add(fourthRow);
           payrollPanel.add(fifthRow);
           payrollPanel.add(sixthRow);
           payrollPanel.add(seventhRow);
           payrollPanel.add(eighthRow);
           payrollPanel.add(ninthRow);
            c.add(payrollPanel);
            c.validate();
            c.repaint();
    class endProgram implements ActionListener
        public endProgram()
        public void actionPerformed(ActionEvent e)
            int answer = JOptionPane.showConfirmDialog(null,"Are you sure you want to end the program","f",JOptionPane.YES_NO_OPTION);
            if (answer == JOptionPane.YES_OPTION)
            System.exit(0);
    class processPayroll implements ActionListener
        public processPayroll()
        public void actionPerformed(ActionEvent e)
            Holder.createPayroll();
    class fileChooser implements ActionListener
        public fileChooser()
        public void actionPerformed(ActionEvent e)
            Holder.createFileChooser();
    class fileBack implements ActionListener
        public fileBack()
        public void actionPerformed(ActionEvent e)
            Holder.createHome();
    class processFinal implements ActionListener
        public processFinal()
        public void actionPerformed(ActionEvent e)
            Holder.processFinal();
    class viewJournal implements ActionListener
        public viewJournal()
        public void actionPerformed(ActionEvent e)
            Holder.createJournal();

  • Time dimension question

    Hi,
    I just created a time dimension from a table that contains all the info I need, Once processed, I went to the browser to finalise the viewing, I have a time period from 2009 to 2025 and once I expand the levels, I see a level unknown right under the
    year 2025, the table I use for this dim is not missing any rows at all, all the columns I need are properly populated, no missing info at all.
    What can cause that and how to suppress this unknown level
    Thanks

    Hi a,
       Analysis Services has a built in member for each dimension called  “Unknown.”  This is to simplify the process of dealing with facts that have the property of Unknown for a particular dimension.  If a dimension member comes to the
    fact table after failing a lookup in the SSIS package and contains a null for the surrogate key, Analysis Services assigns it to this special Unknown Member and moves forward.
        The dimension has a property called UnknownMember that describes the usage of this unknown member.  It can be set to Visible, Hidden, or None.  Next, the dimension member set with the usage of Key has a property called NullProcessing
    that is set to UnknownMember. You can supress the visibilty of Unknown member in this way..Hope this helps
    Regards
    Venkata Koppula

  • Easy JLabel color question

    I want all the labels on a JPanel in blue,
    is there a way to avoid to write each time?:
    label1.setForeground(Color.blue);
    label2.setForeground(Color.blue);
    label3.setForeground(Color.blue);
    label10.setForeground(Color.blue);
    I have try panel.setForeground(Color.blue);
    ..where panel is the container of the labels with no success.
    ?�

    You can always create a subclass of JLabel and have the default settings in the constructor to be blue. Then you just use these labels than the regular JLabels.
    I hope this helps.

  • Simple Array Dimensioning question

    Hey all,
    What is the easiest way to dynamically set the array dimension of an array? I have a method that returns an object array of type Project. The array size of the returned object varries depending on what parameters are passed. I do not know how to declare the object that calls the method. Can you help me? Thanks.
    DetailedProject[] test = new DetailedProject[5];
    test = myBudgetDAO.getProjects("2006","O&M","25","109","98");

    Would I still be able to call the same method with different parameters? Yes. All you say is that the method is returning an array.
    The size of the array matters not to your main program, just that the method returns an array of the appropriate objects.
    Something in your getProjects method you must be declaring/creating an array. Look at that code.
    The getProjects method must know how many to create if it is returning the correctly sized array.
    An alternative is instead of using an array, to use a List (eg ArrayList) which dynamically resizes itself, and you don't need to set inital capacity.

  • MSI R9 280X dimensions question

    Hi,
    I am having a serious problem with my Micro ATX case (Lian-Li PC-V355) trying to "squeeze" a high end card inside it.
    So far I have tried Asus DC2 Top 7970 and MSI Lightning GTX680 without success. Both of these cards were two thick (or too tall for me) with dimensions 129,54 and 129mm respectively.
    I really want to buy the MSI R9 280X but I fear its width will too high for my case...
    Can anyone explain to me how they calculate the width? From which part of the card do MSI start counting?
    Thank you in advance
    Yannis

    Quote from: yannis76 on 04-November-13, 14:26:12
    Is it possible for someone from MSI to tell me the actual width from the PCB to the end of the cooler?
    I am asking this because In my case there is about 20mm free space from PCB and upwards.
    Thank you in advance
    Yannis
    >>How to contact MSI.<<

  • Quick DVD Dimensions Question

    I burned a test DVD of my movie exporting to compressor then importing into DVD Studio.
    I am aware that a DVD played on flat screen TV is going to cut off about 10-20% of the movie around the borders, hence the title safe overlays when editing. Unfortunately when I filmed the movie I did not account for this leaving space at the borders when framing the shots.
    The movie is 16:9.
    I would like like the entire frame to be visable on a flatscreen TV. I am wondering how to resolve this.
    I am considering using some type of feather box or adding black borders. But I don't want to crop out any of the image.
    The other option I am considering is scaling the image down in FCP to fit right inside the title safe zone. But I am skeptical about doing it this way as well. Because I wonder if every flat screen TV is different and each make of TV cuts off a different amount of the image (as opposed to every TV cutting off exactly the same percentage of the image). In that case, if I scale it down into the title safe region, it would fit just right on some flat screens, while others it might be slightly cropped, and on others it would have an ugly black line around the borders.
    Any advice would be appreciated.
    Thanx.

    In Compressor select your DVD encoding preset and in the Inspector open the Geometry window.
    At the bottom is a Padding control with parameters for left, right, top and bottom.
    You will have to use a bit of trial and error to get the effect you want. The numbers you enter in the boxes are pixels. Basically you are adding black pixels to the 4 sides of the frame.

  • JLabel: how to set maximum size in layout?

    I have a BorderLayout that i want to show a JLabel in NORTH. I use HTML in the label message text with one line being centered with <center>. If the overall text of the label is long/big enough, i.e. subsequent text results in line breaks, the cenetered line is cenetered correctly.
    however, if the subsequent text is just small, all lines are left justified/adjusted. i guess, the JLabel dimension is not maximized to the maximum available spave in the NORTH area of BorderLayout.
    I tried adding the JLabel directly or within a JPanel (also with BorderLayout, then with add(label, BorderLayout.CENTER)), also first set the size of the dialog, added all components and just added the text to the label at the last position. doesn't help.

    Tip: putting a border on a JComponent like JLabel helps you see how its parent container is sizing it. I don't know what HTML mark-up you are using, but is the centering necessary?
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    public class Ex {
        public static void main(String[] args) {
            JFrame f = new JFrame("Ex");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            Container cp = f.getContentPane();
            String text = "Example text";
            Border b = BorderFactory.createLineBorder(Color.BLUE);
            JLabel label0 = new JLabel(text, SwingConstants.CENTER);
            label0.setBorder(b);
            JLabel label1 = new JLabel(text);
            label1.setBorder(b);
            cp.add(label0, BorderLayout.NORTH);
            cp.add(label1, BorderLayout.SOUTH);
            f.setSize(400,100);
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

  • Accessing a jlabel on a jpanel

    hi all,
    i have a class A that has a jframe with four jpanels one in each corner. each jpanel has 6 jlabels. my question is how do i access these labels from other classes outside of class A. i want to be able to change the text on each label. any help will be greatly appreciated.
    thanks

    so i assume class A has member varibles jframe, and jpanel1, jpanel2, jpanel3, and jpanel4. each jpanel has jlabel1, jlabel2, jlabel3, jlabel4, jlabel5, and jlabel6. to change the text on the label, you would do:
    jpanel.jlabel1.setText("newText");
    jpanel.jlabel2.setText("another New Text");
    etc...
    does this help???

  • Numbers assigned to user defined dimensions

    Dear Experts
    I have created application set from APPSHELL and created three user defined dimensions viz., A, B and C
    Then removed all not required dimensions including 'P_ACTIVITY' which was a User defined dimension.
    System has assigned numbers as U4, U8 and U9 to these dimensions on its own (I do not know what is the logic system is following to assign numbers to these dimensions)
    Questions:
    1. What is the logic system is following for assignment of the numbers to User defined dimensions?
    2. Can I change these numbers to U1, U2 and U3 (for ease in ad-hoc reporting). If YES how can I do that?
    Thanks

    Hi,
    The userdefined dimensions are named Sequentially as they are created and these are not constant for them, the same dimension may have different names in different applications.
    Also the user defined dimensions are named as Ua to Ux in NW.
    For example, in App1 some dimension X may be named as Uc, the same dimension X in App2 may be named as Ud or some other.
    We need to manually work betweeen "a to x" with the below macro to find the exact name for the user defined dimension in the application.
    "MNU_eTOOLS_MEMBERSELECTOR_X"
    Eg:
    MNU_eTOOLS_MEMBERSELECTOR_Ua
    Also as suggested in earlier replies i dont think this naming can be changed.
    Hope this helps,
    Regards,
    G.Vijaya Kumar

  • LIMIT question

    Hello!
    I've got one interesting question on OLAP DML. Assume you have dimension ARTICLES and one hierarchy with levels CATEGORY, SUB-CATEGORY, ITEM and one cube with variable SALES measured by this dimension.
    question: how to limit ARTICLES dimension to all top 20% items in EACH sub-category based on sales?
    I have tried to prepare a DML program with loop over ARTICLES dimension using TEMPSTAT PUSHLEVEL and POPLEVEL, but it seems that TEMPSTAT kills all PUSH in such loop.
    Does anybody knows how to do it?
    Thank you in advance.

    You're right.. It was interesting :-)
    I couldnt get it to work using just OLAP DML commands..
    ++++++++
    "SUBCAT level
    limit articles to articles_levelrel eq 'SUBCAT'
    "NOTE: DOES NOT WORK for EACH subcat. Adds 20% children of first sub-category in status
    limit articles add limit(limit(articles to children using articles_parentrel articles(articles articles)) keep top npcent percentof total(sales, articles))
    sort articles hierarchy articles_parentrel
    rpr down articles articles_parentrel heading 'SALES' sales heading 'Pct_Parent' sales(articles articles)/sales(articles articles_parentrel(articles articles)) heading 'TopNpcent_Children' limit(limit(articles to children using articles_parentrel articles(articles articles)) keep TOP 20 PERCENTOF total(sales, articles))
    ++++++++
    You can create a DML program and use the Limit function with Top N PERCENTOF based on expression to perform the needful.
    ****** OLAP DML program temp1 ******
    arg _npcent integer
    vrb npcent integer
    vrb vset1 valueset articles
    if _npcent eq na
    then npcent = 20
    else npcent = _npcent
    limit vset1 to na
    limit articles to articles_levelrel eq 'SUBCAT'
    tempstat articles
    DO
    FOR articles
    DO
    limit vset1 add limit(limit(articles to children using articles_parentrel articles(articles articles)) keep top npcent percentof total(sales, articles))
    DOEND
    DOEND
    limit articles add vset1
    sort articles hierarchy articles_parentrel
    temp1 20
    rpr down articles articles_parentrel Heading 'SALES' sales Heading 'Pct_Parent' sales(articles articles)/sales(articles articles_parentrel(articles articles)) Heading 'TopNpcent_Children' limit(limit(articles to children using articles_parentrel articles(articles articles)) keep TOP 20 PERCENTOF total(sales, articles))

  • Linking Swing classes

    I need the link the two classes I have pasted below. Please examine the code, I have created a new object of the type, the second class, but it doesnt execute when the option dialog is pressed, please advise on how i can get it to work... but classes are error free and work. Help would be much appreciated
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class MainMenu extends JFrame implements ActionListener {
    JButton exRwButton;
    JButton exQsButton;
    JButton dspExButton;
    JButton exitButton;
    JButton exInButton;
    JLabel MainMenuLabel;
    JFrame frame;
    public MainMenu() {
    MainMenuLayout customLayout = new MainMenuLayout();
    getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12));
    getContentPane().setLayout(customLayout);
    exRwButton = new JButton("Excercise Review");
    getContentPane().add(exRwButton);
              exRwButton.addActionListener(this);
              exQsButton = new JButton("Excercise Questionaire");
    getContentPane().add(exQsButton);
    exQsButton.addActionListener(this);
              dspExButton = new JButton("Display Current Excercise Plan");
    getContentPane().add(dspExButton);
    dspExButton.addActionListener(this);
    exitButton = new JButton("Exit Excercise Asistant");
    getContentPane().add(exitButton);
    exitButton.addActionListener(this);
    exInButton = new JButton("Initial Questionaire");
    getContentPane().add(exInButton);
              exInButton.addActionListener(this);
              MainMenuLabel = new JLabel("Excercise Asistant Main Menu");
    getContentPane().add(MainMenuLabel);
    setSize(getPreferredSize());
    public static void main(String args[]) {
    MainMenu window = new MainMenu();
    window.setTitle("MainMenu");
    window.pack();
    window.show();
    public void actionPerformed(ActionEvent e)
         MainMenu frame = new MainMenu();
         //dispose();
         Object source = e.getSource();
         if(source instanceof JButton)
              if(source == exRwButton)
                   Object[] options1 = {"Yes", "Cancel"};
    JOptionPane.showOptionDialog(
    frame, "Would you like to perform an Excercise Plan Review?",
    "Confirm Selection",
    JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options1, options1[0]);
              else if (source == exQsButton)
                   Object[] options2 = {"Yes", "Cancel"};
    JOptionPane.showOptionDialog(frame, "Would you like to perform an Excercise Plan Questionaire?",
    "Confirm Selection",
    JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options2, options2[0]);
              else if(source == exInButton)
                   Object[] options3 = {"Yes", "Cancel"};
    JOptionPane.showOptionDialog(
    frame, "Would you like to perform an Intial Personal Questionaire?",
    "Confirm Selection",
    JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options3, options3[0]);
    Menu1 me = new Menu1(); // i have added this statement to open the next java file with
                                                 //the class name Menu1, but it doesnt seam to work
              else if(source == dspExButton)
                   Object[] options4 = {"Yes", "Cancel"};
    JOptionPane.showOptionDialog(
    frame, "Would you like to display your current Excecise Plan?",
    "Confirm Selection",
    JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options4, options4[0]);
              else if(source == exitButton)
                   Object[] options5 = {"Yes", "Cancel"};
    JOptionPane.showOptionDialog(
    frame, "Are you sure you want to exit the excercise assistant?",
    "Confirm Selection",
    JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options5, options5[0]);
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    class MainMenuLayout implements LayoutManager {
    public MainMenuLayout() {
    public void addLayoutComponent(String name, Component comp) {
    public void removeLayoutComponent(Component comp) {
    public Dimension preferredLayoutSize(Container parent) {
    Dimension dim = new Dimension(0, 0);
    Insets insets = parent.getInsets();
    dim.width = 510 + insets.left + insets.right;
    dim.height = 242 + insets.top + insets.bottom;
    return dim;
    public Dimension minimumLayoutSize(Container parent) {
    Dimension dim = new Dimension(0, 0);
    return dim;
    public void layoutContainer(Container parent) {
    Insets insets = parent.getInsets();
    Component c;
    c = parent.getComponent(0);
    if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+72,240,24);}
    c = parent.getComponent(1);
    if (c.isVisible()) {c.setBounds(insets.left+264,insets.top+72,240,24);}
    c = parent.getComponent(2);
    if (c.isVisible()) {c.setBounds(insets.left+264,insets.top+112,240,24);}
    c = parent.getComponent(3);
    if (c.isVisible()) {c.setBounds(insets.left+168,insets.top+160,184,24);}
    c = parent.getComponent(4);
    if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+112,240,24);}
    c = parent.getComponent(5);
    if (c.isVisible()) {c.setBounds(insets.left+152,insets.top+24,208,24);}
    //class which precious code should connect to i.e. open when selection is made from option dialog
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Menu1 extends JFrame {
    JLabel genderLabel;
    JLabel titleLabel;
    JLabel iniQLabel;
    JLabel ageLabel;
    JComboBox ageCombobox;
    ButtonGroup cbg;
    JRadioButton radio_1;
    JRadioButton radio_2;
    JLabel weightLabel;
    JComboBox weightCombobox;
    JLabel heightLabel;
    JComboBox heightCombobox2;
    JComboBox heightCombobox1;
    JLabel q1Label;
    JComboBox q1Combobox;
    JLabel q2Label;
    JComboBox q2Combobox;
    JLabel q3Label;
    JComboBox q3Combobox;
    JLabel q1Label2;
    JLabel q4Label;
    JComboBox q4Combobox;
    JLabel q4Label2;
    JLabel q5Label;
    JComboBox q5Combobox;
    JButton submitButton;
    JLabel decisionLabel;
    JLabel label_2;
    JLabel decisionLabel2;
    public Menu1() {
    Menu1Layout customLayout = new Menu1Layout();
    getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12));
    getContentPane().setLayout(customLayout);
    genderLabel = new JLabel("Gender");
    getContentPane().add(genderLabel);
    titleLabel = new JLabel("Please answer the following questions:");
    getContentPane().add(titleLabel);
    iniQLabel = new JLabel("Personal Questions");
    getContentPane().add(iniQLabel);
    ageLabel = new JLabel("Age Range");
    getContentPane().add(ageLabel);
    ageCombobox = new JComboBox();
    ageCombobox.addItem("Select");
    ageCombobox.addItem("16 - 20");
    ageCombobox.addItem("20 - 25");
    ageCombobox.addItem("25 - 30");
    ageCombobox.addItem("30 - 40");
    ageCombobox.addItem("40 - 50");
    ageCombobox.addItem("50+");
    getContentPane().add(ageCombobox);
    cbg = new ButtonGroup();
    radio_1 = new JRadioButton("Male", false);
    cbg.add(radio_1);
    getContentPane().add(radio_1);
    radio_2 = new JRadioButton("Female", false);
    cbg.add(radio_2);
    getContentPane().add(radio_2);
    weightLabel = new JLabel("Weight Range");
    getContentPane().add(weightLabel);
    weightCombobox = new JComboBox();
    weightCombobox.addItem("Select");
    weightCombobox.addItem("40 - 50");
    weightCombobox.addItem("50 - 60");
    weightCombobox.addItem("60 - 70");
    weightCombobox.addItem("70 - 80");
    weightCombobox.addItem("80 - 90");
    weightCombobox.addItem("90 - 120");
    weightCombobox.addItem("120+");
    getContentPane().add(weightCombobox);
    heightLabel = new JLabel("Height Range");
    getContentPane().add(heightLabel);
    heightCombobox2 = new JComboBox();
    heightCombobox2.addItem("cm");
    heightCombobox2.addItem("10");
    heightCombobox2.addItem("20");
    heightCombobox2.addItem("30");
    heightCombobox2.addItem("40");
    heightCombobox2.addItem("50");
    heightCombobox2.addItem("60");
    heightCombobox2.addItem("70");
    heightCombobox2.addItem("80");
    heightCombobox2.addItem("90");
    getContentPane().add(heightCombobox2);
    heightCombobox1 = new JComboBox();
    heightCombobox1.addItem("Metres");
    heightCombobox1.addItem("0");
    heightCombobox1.addItem("1");
    heightCombobox1.addItem("2");
    getContentPane().add(heightCombobox1);
    q1Label = new JLabel("How many hours a week would would you like to excercise?");
    getContentPane().add(q1Label);
    q1Combobox = new JComboBox();
    q1Combobox.addItem("Hours");
    q1Combobox.addItem("1");
    q1Combobox.addItem("2");
    q1Combobox.addItem("3");
    q1Combobox.addItem("4");
    q1Combobox.addItem("5");
    q1Combobox.addItem("10");
    q1Combobox.addItem("15");
    q1Combobox.addItem("20");
    getContentPane().add(q1Combobox);
    q2Label = new JLabel("What kind of excercise would suit you best?");
    getContentPane().add(q2Label);
    q2Combobox = new JComboBox();
    q2Combobox.addItem("Excercise Type");
    q2Combobox.addItem("Sports Activity");
    q2Combobox.addItem("Group Sports");
    q2Combobox.addItem("Aerobic");
    q2Combobox.addItem("Anaerobic");
    getContentPane().add(q2Combobox);
    q3Label = new JLabel("if your choose \"Aerobic\" please specify type.");
    getContentPane().add(q3Label);
    q3Combobox = new JComboBox();
    q3Combobox.addItem("Aerobic Types");
    q3Combobox.addItem("Running");
    q3Combobox.addItem("Circuit Training");
    q3Combobox.addItem("Swimming");
    q3Combobox.addItem("Stair Climbing");
    getContentPane().add(q3Combobox);
    q1Label2 = new JLabel("(Active hours per week for adult human is 60hrs approx)");
    getContentPane().add(q1Label2);
    q4Label = new JLabel("If you chose \"Anaerobic\" please specify type.");
    getContentPane().add(q4Label);
    q4Combobox = new JComboBox();
    q4Combobox.addItem("Anerobic Type");
    q4Combobox.addItem("Free Weights");
    q4Combobox.addItem("General Weight Training");
    q4Combobox.addItem("General Resistance");
    getContentPane().add(q4Combobox);
    q4Label2 = new JLabel("Note. Genral Resistance is for people whom have access to gym equipment");
    getContentPane().add(q4Label2);
    q5Label = new JLabel("What is the main Purpose of your Excercise Plan, What is your main excercise focus, ");
    getContentPane().add(q5Label);
    q5Combobox = new JComboBox();
    q5Combobox.addItem("Goals");
    q5Combobox.addItem("Muscle Gain");
    q5Combobox.addItem("Fat Loss");
    q5Combobox.addItem("Weight Loss");
    q5Combobox.addItem("Increased Fitness");
    getContentPane().add(q5Combobox);
    submitButton = new JButton("Submit");
    getContentPane().add(submitButton);
    decisionLabel = new JLabel("When you have filled out questionaire press submit button to go back to the main");
    getContentPane().add(decisionLabel);
    label_2 = new JLabel("please select most appropriate option.");
    getContentPane().add(label_2);
    decisionLabel2 = new JLabel("menu where you can select the Excercise Questionsaire");
    getContentPane().add(decisionLabel2);
    setSize(getPreferredSize());
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    public static void main(String args[]) {
    Menu1 window = new Menu1();
    window.setTitle("Menu1");
    window.pack();
    window.show();
    class Menu1Layout implements LayoutManager {
    public Menu1Layout() {
    public void addLayoutComponent(String name, Component comp) {
    public void removeLayoutComponent(Component comp) {
    public Dimension preferredLayoutSize(Container parent) {
    Dimension dim = new Dimension(0, 0);
    Insets insets = parent.getInsets();
    dim.width = 594 + insets.left + insets.right;
    dim.height = 593 + insets.top + insets.bottom;
    return dim;
    public Dimension minimumLayoutSize(Container parent) {
    Dimension dim = new Dimension(0, 0);
    return dim;
    public void layoutContainer(Container parent) {
    Insets insets = parent.getInsets();
    Component c;
    c = parent.getComponent(0);
    if (c.isVisible()) {c.setBounds(insets.left+256,insets.top+72,64,16);}
    c = parent.getComponent(1);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+16,272,16);}
    c = parent.getComponent(2);
    if (c.isVisible()) {c.setBounds(insets.left+32,insets.top+48,120,16);}
    c = parent.getComponent(3);
    if (c.isVisible()) {c.setBounds(insets.left+32,insets.top+72,96,16);}
    c = parent.getComponent(4);
    if (c.isVisible()) {c.setBounds(insets.left+128,insets.top+72,88,24);}
    c = parent.getComponent(5);
    if (c.isVisible()) {c.setBounds(insets.left+256,insets.top+88,88,16);}
    c = parent.getComponent(6);
    if (c.isVisible()) {c.setBounds(insets.left+256,insets.top+104,88,16);}
    c = parent.getComponent(7);
    if (c.isVisible()) {c.setBounds(insets.left+32,insets.top+128,96,16);}
    c = parent.getComponent(8);
    if (c.isVisible()) {c.setBounds(insets.left+128,insets.top+128,88,24);}
    c = parent.getComponent(9);
    if (c.isVisible()) {c.setBounds(insets.left+256,insets.top+128,80,16);}
    c = parent.getComponent(10);
    if (c.isVisible()) {c.setBounds(insets.left+432,insets.top+128,72,24);}
    c = parent.getComponent(11);
    if (c.isVisible()) {c.setBounds(insets.left+360,insets.top+128,72,24);}
    c = parent.getComponent(12);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+168,512,16);}
    c = parent.getComponent(13);
    if (c.isVisible()) {c.setBounds(insets.left+32,insets.top+184,120,24);}
    c = parent.getComponent(14);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+216,512,16);}
    c = parent.getComponent(15);
    if (c.isVisible()) {c.setBounds(insets.left+32,insets.top+232,168,24);}
    c = parent.getComponent(16);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+264,512,16);}
    c = parent.getComponent(17);
    if (c.isVisible()) {c.setBounds(insets.left+32,insets.top+280,168,24);}
    c = parent.getComponent(18);
    if (c.isVisible()) {c.setBounds(insets.left+160,insets.top+184,376,16);}
    c = parent.getComponent(19);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+320,512,16);}
    c = parent.getComponent(20);
    if (c.isVisible()) {c.setBounds(insets.left+32,insets.top+360,128,24);}
    c = parent.getComponent(21);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+336,512,16);}
    c = parent.getComponent(22);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+408,512,16);}
    c = parent.getComponent(23);
    if (c.isVisible()) {c.setBounds(insets.left+32,insets.top+456,176,24);}
    c = parent.getComponent(24);
    if (c.isVisible()) {c.setBounds(insets.left+208,insets.top+552,104,24);}
    c = parent.getComponent(25);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+504,512,16);}
    c = parent.getComponent(26);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+424,512,16);}
    c = parent.getComponent(27);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+520,512,16);}

    Compare the code in your listenerMenu1 me = new Menu1(); // i have added this statement to open the next java file with
    //the class name Menu1, but it doesnt seam to workwith the code in the main method of Menu1Menu1 window = new Menu1();
    window.setTitle("Menu1");
    window.pack();
    window.show();See anything missing above?

  • Logical level for logical fact table sources

    it is clear that for fact aggregates, we should use the Content tab of the Logical Table Source dialog to assign the correct logical level to each dimension.
    question is : is it mandatory to assign even for non-aggregates fact tables the logical level for each dimension (which normally should be set to the most detailed level of each dimension) ? is it any known issue if "logical levels"in content tab are not set ?
    the reason I'm asking this is a strange bug I have (I'm not going to discuss it here) and then only workaround seems to be NOT setting the logical levels (on content tab) for logical fact table sources.
    thank you !

    If levels are not set: By default levels are considered as lowest level
    It should not matter if you set or not
    Generally we set for facts explicitly when we are using Aggregate tables.
    Your current issue might be a case by case; I would suggest to check implicit fact, any table mapped to the source to force a join etc
    Mark if helps
    Let me know how it helps
    Edited by: Srini VEERAVALLI on Feb 5, 2013 8:33 AM
    Any updates on this?+_
    Edited by: Srini VEERAVALLI on Feb 14, 2013 9:09 AM

Maybe you are looking for

  • ITunes Store refuses to load

    Everything else works fine, my library, syncing with my iPod, etc. I'm running Windows Vista, and the problem showed up when I started traveling in Europe (is there some rule I'm mising...??)  I don't get an error message or a time-out warning, the l

  • Can I assign diffierent GL to movement type 601(GI)  and 459(return to bl ?

    dear friends, we have GL50000 (cost of goods sales) assigned to both movement type 601(goods issue) and 459( transfer posting from return to bloked stock). My question is : 1. Can I assign different GL to these two types of goods movement? 2. in whic

  • I cannot print a shipping label from the USPS Store website from Adobe 9

    I cannot print a shipping label from the USPS Store website from Adobe 9

  • PI : Message Status Description ?

    Hi, Please advise where i can get detail information / description on the PI Message status below : Integration Server : Message Status ============== Message Status:      000 Message Status:      001 Message Status:      002 Message Status:      003

  • Warning on activation of iPad

    I bought my wife an iPad Mini for Christmas. Since we are not going to be home at Christmas time when I give it to her, I activated it on her computer and loaded all the apps from her first generation iPad. Unfortunately, Apple sent a congratulatory