Unexplained indentation after JComboBox

Hey folks,
I've got a bit of an odd problem here, which is either because of my ignorance of JComboBox behaviour or simply an odd bug or feature in said JComboBox component.
Basically, I've got an Options window that, in my application, is opened using a JOptionPane. (So it's a Dialog instead of a Frame.) In this Options window, I've got a JPanel (holder) that holds another JPanel (copying). This JPanel holds another JPanel (bufferSize) and two JCheckBoxes. In the last JPanel (bufferSize) is a JLabel and a JComboBox.
The problem lies with the JComboBox; below the JComboBox come the two JCheckBoxes that now have, unexplicably, an indentation of about 100 pixels. Below I've added the simplified code of the problem. If you guys want to see it for yourself, create three Java files with the said class names and run the ComboExample.java file. (It's the one with the main method... ;))
So, essentially; any of you have a clue what's causing this indentation? More information available in the form of comments in the code. I've also got an email subscription to this thread, so feel free to ask any questions about the code and supply me with suggestions. I'll try to reply as soon as I get the email.. ;)
import javax.swing.JFrame;
public class ComboExample{
     public static void main(String args[]){
          GUI gui = new GUI();
          gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          gui.setSize(350, 75);
          gui.setTitle("Example app; opening the options menu");
          gui.setVisible(true);
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class GUI extends JFrame implements ActionListener{
     private JButton buttonOpenDialog;
     // Constructor; creates button, adds actionlistener and adds button to frame
     public GUI(){
          buttonOpenDialog = new JButton("Open the new dialog!");
          buttonOpenDialog.addActionListener(this);
          add(buttonOpenDialog);
     // Mandatory method that controls what happens when the button's pressed
     // (When pressed: new window opens called Options)
     public void actionPerformed(ActionEvent e) {
          if(e.getSource() == buttonOpenDialog){
               Options options = new Options();
               JOptionPane.showMessageDialog(null, options, "Options menu", JOptionPane.PLAIN_MESSAGE);
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.*;
import javax.swing.border.TitledBorder;
public class Options extends JPanel{
     private JCheckBox showCopyOverview;
     private JCheckBox showCopyErrorMessages;
     private JComboBox bufferSize;
     // Constructor calls createInterface method
     public Options(){
          createInterface();
      * Creates the interface. First a holder panel is created that uses a BorderLayout.
      * This is done for future implementations. Then there's a copying panel with its own
      * border and text on border. This panel uses a Vertical (Y_AXIS) BoxLayout. To these
      * the various options are added. Lastly, the Combobox is on its own panel so that
      * the label can appear next to it. This panel also uses a BoxLayout, but then a horizontal
      * (X_AXIS) variant.
      * My question now is; why do the two checkboxes below the JComboBox and JLabel have
      * that indentation that they do? I never tell them to do that.
      * Solutions tried:
      * - Setting a maximum size (setMaximumSize())
      * - Removing the JComboBox (worked partially; the indentation became smaller)
      * - Removing the JLabel (worked partially, see above)
      * - Removing the bufferSizePanel but leaving the JLabel and JComboBox
      * - Removing the bufferSizePanel, JLabel and JComboBox (works, but evidently not desired)
      * - Putting the two JCheckBoxes on a different JPanel
      * - Suggestions... ?
     public void createInterface(){
          // First create all the required panels
          JPanel panelHolder = new JPanel();
          panelHolder.setLayout(new BorderLayout());
          JPanel panelCopying = new JPanel();
          panelCopying.setLayout(new BoxLayout(panelCopying, BoxLayout.Y_AXIS));
          TitledBorder borderCopying = BorderFactory.createTitledBorder("Copying options");
          panelCopying.setBorder(borderCopying);
          JPanel panelBufferSize = new JPanel();
          panelBufferSize.setLayout(new BoxLayout(panelBufferSize, BoxLayout.X_AXIS));
          // Create all the elements that will inhabit the panels
          showCopyOverview = new JCheckBox("Option 1");
          showCopyErrorMessages = new JCheckBox("Option 2");
          JLabel labelBufferSize = new JLabel("Option 3: ");
          bufferSize = new JComboBox();
          bufferSize.setMaximumSize(new Dimension(65, 25));
          // Add all the elements to their respective panels
          panelBufferSize.add(labelBufferSize);
          panelBufferSize.add(bufferSize);
          panelCopying.add(panelBufferSize);
          panelCopying.add(showCopyOverview);
          panelCopying.add(showCopyErrorMessages);
          panelHolder.add(panelCopying, BorderLayout.CENTER);
          add(panelHolder);
}Edited by: SEThorian on Dec 4, 2008 1:35 PM

You are looking for JComponent#setAlignmentX(float).
[How to Use BoxLayout (The Java™ Tutorials > Creating a GUI with JFC/Swing > Laying Out Components Within a Container)|http://java.sun.com/docs/books/tutorial/uiswing/layout/box.html]
import java.awt.*;
import javax.swing.*;
public class ComboExample{
    public static void main(String[] args) {
        JOptionPane.showMessageDialog(null, new Options(),
                      "Options menu", JOptionPane.PLAIN_MESSAGE);
class Options extends JPanel{
    private JCheckBox showCopyOverview;
    private JCheckBox showCopyErrorMessages;
    private JComboBox bufferSize;
    public Options(){
        super(new BorderLayout());
        createInterface();
    public void createInterface(){
        bufferSize             = new JComboBox();
        showCopyOverview       = new JCheckBox("Option 1");
        showCopyErrorMessages  = new JCheckBox("Option 2");
        JPanel panelBufferSize = new JPanel(new BorderLayout());
        panelBufferSize.add(new JLabel("Option 3: "), BorderLayout.WEST);
        panelBufferSize.add(bufferSize);
        Box panelCopying = Box.createVerticalBox();
        panelCopying.setBorder(
           BorderFactory.createTitledBorder("Copying options"));
        panelCopying.add(panelBufferSize);
        panelCopying.add(showCopyOverview);
        panelCopying.add(showCopyErrorMessages);
        panelBufferSize.setAlignmentX(Component.LEFT_ALIGNMENT);
        showCopyOverview.setAlignmentX(Component.LEFT_ALIGNMENT);
        showCopyErrorMessages.setAlignmentX(Component.LEFT_ALIGNMENT);
        add(panelCopying);
}

Similar Messages

  • Code Style one character indent after a comment line

    I have a problem with "Code Style" formatting undesirably. Any time I put a comment (//) line into my code the next line is indented one space. I can't find any setting in "Code Style" that alters this. I end up doing a lot of manual format editing to get rid of those spaces (the real problem is when I cut and paste a large block of code after a comment line - then the entire code block, every line, has that extra space of indenting).
    Does anyone know how to alter this behavior?
    This is with JDeveloper 10.1.3.3.

    You can use an "indent to here" character before Diesel or set up your paragraph as follows
    left indent 0.125" (or whatever)
    first line indent -0.125"
    You should use your existing paragraph style, too. No need for a new one the way you've described it.

  • Unexplained hangs after Leopard reinstallation

    I had to reinstall Leopard because it was causing some problems with my .Mac account and Quicktime wasn't playing movies. Not sure what reinstalling fixed both those problems, but now I've noticed that different programs would suddenly freeze up for a few seconds. Sometimes I can use other programs, sometimes it's just really slow.
    I've tried isolating the problem to see if it was unique to any particular software, but it seems to happen to any: Firefox, iTunes, Entourage, iMovie, Quicktime.
    I have a MacBook Pro, 4 GB 667 MHz DDR2 SDRAM 2.4 GHz
    Any suggestions?

    Where would I find these things? (Sorry, I'm newish to the Mac)
    I'm noticing that it hangs up often when I'm doing searches on my Mac. Not sure if that's the only time it hangs up, but it definitely hangs up when I'm searching. What might that suggest? My laptop is relatively empty. It still has about 120 GB (out of 200) free.

  • Request for enhancement

    I've been using JDeveloper 9i for about 6 months now. In the beta releases there were some
    annoying bugs, but those seem to have been fixed in the final version. So now I'm mostly
    satisfied with the product. It's a great IDE with a lot of nice features. I've decided to
    use it instead of JBuilder mostly because of the price. The reason I'm posting this is that
    there are some minor things that I would like to be improved in the product. Some of them I
    consider bugs, other missing features. Hardly any of them are really serious, but they can
    get annoying when you're doing something every day. Some of these I've grown accustomed to
    in other IDEs. Maybe you've heard about some of these things before. Maybe you've already
    fixed some of them. Well here we go:
    1. It is not possible to replace text only within the selected area of a file. The replacement
    always affects the whole file.
    2. The only way to accept a suggestion from Code Insight is to press enter. It would be nice
    if you could also use the next logical operator like . (dot). Then the editor should insert the
    selected suggestion followed by . and start Code Insight again on the next level of the expression.
    3. Copying text does not always work. Sometimes I have to press Ctrl+C many times for the text
    to be copied. I have a feeling this happens when I do it too quickly. Could be a general Java bug.
    Also it seems to only happen on my home PC which is very slow (300 mHz). It's too slow for
    JDeveloper anyway, so I need a new one. JDeveloper, like all IDEs written in Java, is very
    resource intensive. I guess that's just a fact of life.
    4. I would like automatic indent after {
    5. I would like } to automatically align with the corresponding {
    6. When inserting Code Templates you have to know the exact code for a template. It would be nice
    to be able to type only part of the code and have the editor show me a list of templates whose code
    start with those characters.
    7. In the dialog box for overriding methods you have to use the mouse to check which methods to
    override. I would like to be able to use the space bar for that purpose.
    8. The dialog boxes for implementing interfaces and overriding methods do not work for inner
    classes.
    9. Code Insight does not always work. Sometimes the list of suggestions only includes classes
    and not variables and methods in the current class/method. This seem to happen only when the cursor
    is to the right of an operator, including comma. So for instance Code Insight works for the first
    argument in a method invocation, but not for subsequent arguments. And it works for the left hand
    side of an addition, multiplication etc., but not for the right hand side.
    10. When you add a new variable in the class editor, you cannot declare its type as an array.
    11. In the debugger it would be nice to have breakpoints that would fire when the value of a
    variable changed.
    12. In the debugger it would be nice to be able to evaluate and watch the result of method calls.
    13. It would be nice to have a tool to internationalise and localise an application's hard coded
    text strings.
    14. It would be nice to have numbered bookmarks in the editor. Press one key combination to set
    a bookmark and another one to jump back to that same bookmark.
    15. In the class editor there is another small problem. When you tell it to make a property bound,
    it adds the methods addPropertyChangeListener/removePropertyChangeListener/firePropertyChange and
    the variable propertyChangeSupport. This is good, but the problem is that JDeveloper doesn't look in
    the superclasses to see if they already contain these methods/variables.
    16. In the property editor you cannot set the displayed mnemonic of a JLabel to a character. You have
    to use the character code.
    17. When you edit a property in the property editor and then press enter the focus moves to the first
    property.
    18. In the property editor when you edit a property that has a drop down list of possible values, you
    cannot change the value using the keyboard (at least not by pressing enter). This may be a Java bug.
    19. In the property editor the property horizontalAlignment cannot be changed at all. For instance I
    get a message like "Field RIGHT not found in class javax.swing.JTextField".
    20. The Oracle JVM doesn't handle class and method names that use the special Norwegian characters
    with these unicode numbers: 198 216 197 230 248 229
    According to the Java standard it should, and the Sun JVM has always done so.
    21. Finally, one thing that would be really nice is for the UI editor to support visual form inheritance
    like Delphi does. I don't think any Java IDEs do, and it's the thing that I miss the most.

    16. In the property editor you cannot set the displayed mnemonic of a JLabel to a character. You have
    to use the character code. This has been fixed in the soon to be availabel release 9.0.3
    17. When you edit a property in the property editor and then press enter the focus moves to the first
    property.This has been fixed in the soon to be availabel release 9.0.3
    18. In the property editor when you edit a property that has a drop down list of possible values, you
    cannot change the value using the keyboard (at least not by pressing enter). This may be a Java bug.This is a known bug; 2157458
    19. In the property editor the property horizontalAlignment cannot be changed at all. For instance I
    get a message like "Field RIGHT not found in class javax.swing.JTextField". Works fine in the soon to be available release 9.0.3. The problem was that the SwingConstants import was not being
    added. There does remain, however, a similar bug (2337382) where constants inherited via an interface will still
    produce the same problem (e.g. setting orientation property of JScrollPane which implements SwingConstants). This
    is still sceduled to be addressed in 9.0.3.
    21. Finally, one thing that would be really nice is for the UI editor to support visual form inheritance
    like Delphi does. I don't think any Java IDEs do, and it's the thing that I miss the most. Some work has been done in this area for 9.0.3 which will improve the user experience (user will see an accurate
    portrayal of the superclass available for design, however access to inherited members is not yet ready). There still
    remains more work to do in this area that is currently scheduled for release 9.0.4..

  • Formatting a TOC in Indesign 5.5

    Let's see if I can explain this clearly. I am using Indesign 5.5 to generate a book TOC. The format I want is:
    Frame 1 (A chapter number that isn't printed) then a tab then Frame 2 then right ident tab for the page number. There is enough room to be all on one line.
    Frame 1 is on a non printing layer (from layer 2); Frame 2 is the chapter title (on layer 1). Each frame has a seperate paragraph style. In the toc dialog box I have tried to set both frames as level one with the number coming after frame 2; I have tried them on two different levels with no number after one and the number right indented after frame 2 BUT they always come out the same: frame 2 comes first then on a seperate line is frame 1 (these frames are backward) and the page number prints on a third line.
    I am hoping it is just my stupidity.
    Help Appreciated.

    Thanks for your quick response Peter. It feels like it should be able to be done. It is grabbing the right info but is just putting it on seperate lines and in reverse order.
    An example of what I want is:
    Hexagram One     Our Creative Essence               33
    Hexagram One is the content from a non printing layer, next is the chapter title and then the page number.
    What I get is
    Our Creative Essence
    Hexagram One
    33

  • List servers via WLST

    Hi,
    Suppose I want to list all the servers configured on a domain and then in a for loop in python I am gonna change some configuration.
    I want to know how to list all the servers on domain.
    thanks
    Amar

    Maybe this can be helpful
    listServers.py
    connect("weblogic","WEBLOGIC1", "t3://localhost:7001")
    edit()
    startEdit()
    mbServers= getMBean("Servers")
    servers= mbServers.getServers()
    print( "Array of servers: " )
    print( servers )
    for server in servers :
         print( "Server Name: " + server.getName() )
         # Make your configuration changes here, for example:
         server.setConnectTimeout( 30 )
         server.setNativeIOEnabled ( true )
         server.setStartupMode( "ADMIN" )
         print( "Saving changes for " + server.getName() )
         save()
    activate()
    print( "Done." )
    Don't forget indentation after loop line until save() line.
    Edited by: Betino on 27/06/2011 12:17 PM

  • [restart shiretoko] button does not work

    The "restart shiretoko" button in the browsers add-on manager simply closes shiretoko and does not restart it. I then have to attempt to start it twice before it comes back.
    The problem is identical under Openbox and Xmonad WM.
    The terminal output of firefox doesn't seem to ouptut anything related:
    (firefox:26539): GLib-WARNING **: g_set_prgname() called multiple times
    Registering '@mozilla.org/module-loader/python;1' (libpyloader.so)
    Registering '@mozilla.org/network/protocol/about;1?what=python' (pyabout.py)
    FoxyProxy settingsDir: /home/kaspar/.mozilla/firefox/0ywn17bi.default/foxyproxy.xml
    OpenOffice path is '/usr/lib/openoffice'
    Last edited by kasbah (2009-12-21 21:30:51)

    for me it works as indented after an add on install. If you talking about this then it is outdated. One way to check is clear your cache or delete and create a new profile. As this is specific to Firefox checking their forum or a web search give you more insight.

  • Format changing after running the concurrent program for indentation

    Hi
    I have got an issue regarding indentation in rtf template. Actually in the template I have indentation or numbering in one format like david but after running the concurrent program in the temlate output I am getting the numbering in Latin letters. like
    I
    II
    III
    etc.
    can anyone please send me the resolution for this issue.
    Thanks and regards
    kk

    What is the application release?
    If you are on 11i, please make sure you have (Patch 8198363: INDENTATION PROBLEM WHILE GENERATING RTF OUTPUT USING RTF TEMPLATE) applied and check then.
    Thanks,
    Hussein

  • Indent changing is possible but changes are not reflecting after refresh

    Hello all,
    I am facing one issue with alignment in the BEX. i need to changed the the result rows. initally the indent is 2 , am changing it to 1 and saving as existing report. after  refreshing the workbook. the changes are not reflecting. can anybody provide me some inputs on these. any help is appreciated.

    Hi Priya,
    You need to Implement the following SNOTE's for these changes.
    Union Budget 2015: As per Finance Bill 2015, the Government has implemented amendments to existing sections and introduced new sections in the Income Tax Act. Changes have been made in the following topics:
    Tax Surcharge Rate
    Increase in Conveyance Allowance
    Section 80
    Sukanya Samriddhi Scheme: The Government has launched this new deposit scheme for the minor girl child. This is a savings scheme that can be opened by the natural (biological) or legal guardian of a girl child aged below 10 years. Related Notes:
    2139208 - Union Budget Changes – 2015
    2138605 - Sec80C: Sukanya Samriddhi Scheme
    Upcoming Developments:
    PF Admin Charges Revision
    Professional Tax for Mizoram & Nagaland states
    Average Rate of Tax
    Regards,
    Venkat Polisetty

  • Possible to get JComboBox before and after chaged value?

    Hi,
    I have a JComboBox... whenever the JComboBox value change is it possible to get the before and after changed value? For example:
    Let says the JComboBox is showing "One" and the user change it to "Three" after the user chged... I want to System.out.println before chged value ("One") and aft chged value ("Three")
    I tried:
    put in some code in the itemStateChanged() method... but no success...
    Can someone pls provide some pointer or sample code...
    Thank you for your time...

    Ok, I lost half a day on this (novice problem), but I arranjed a solution that resolve the problem totally. There is the code:
    YourComboBox.addFocusListener(new java.awt.event.FocusAdapter()
            int aux_selected;
            // if YourComboBox gains Focus
           public void focusGained(java.awt.event.FocusEvent fe)
                // get index value of selected element
               aux_selected= YourComboBox.getSelectedIndex();
               // create a variable for storing de ItemListener
              ComboBListener = new java.awt.event.ItemListener() {
                   public void itemStateChanged(java.awt.event.ItemEvent e)
                       if(e.getStateChange()==java.awt.event.ItemEvent.SELECTED)
                           // compares the selected value with the old one
                           if (aux_selected!=YourComboBox.getSelectedIndex())
                           System.out.println("ComboBox Changed !");
               // add the variable Listener to your Combo
               YourComboBox.addItemListener(ComboBListener);
           // if focus is lost
           public void focusLost(java.awt.event.FocusEvent fe)
              // remove the itemListener from the combobox
             YourComboBox.removeItemListener(ComboBListener);
    //Put the Listener variable outside
    private java.awt.event.ItemListener ComboBListener; //----------------------------------------------------------------------------------------------------
    You only have to change YourComboBox by the name of the combobox.
    To all people that help this forum (specially from PORTUGAL) and all java people: YOU ARE DOING A GREAT JOB

  • JComboBox fires an event only after changed selection?!

    I have added a JComboBox to my application, combined with an ActionListener which is added to the combobox just after initialization. It works fine, but there is one problem left:
    Generally, an event for the ActionListener is initially only fired by a combobox, if the user selects a different item than the last selected one. But I need an event that is fired by the combobox each time an item will be selected, even if it is the same item as the last selected one.
    I tried to use an ItemChangeListener, but it gave no success (and sense), it fires an event each time the user wants to select an item from the combobox' item list, that is no solution.
    Best way to solve this problem? I thought about a adding a MouseListener, but that might be the longest way. There seems to be no special method in JComboBox class to set this desired property?
    Any suggestions?

    Hello,
    thank you for your answer so far. Well, here is a trivial source code with the problem that still exists (see also my text at the end of this post). This one has been tested using Java 2 SDK V1.4, even using the newest SDK version did not change anything on the behaviour:
    import javax.swing.*;
    import java.awt.Container;
    import java.awt.FlowLayout;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    * JComboBox-Test: using Java 2 SDK V1.4, ActionEvent is only fired by combobox, if
    * a different item than the previous one is selected from combobox;
    public class Forum3 extends JFrame implements ActionListener {
        String[] CB_ITEMS = {
            "item 1",
            "item 2",
            "item 3",
        public Forum3 () {
            super();
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            setLayout(new FlowLayout());
            JComboBox cb = new JComboBox(CB_ITEMS);
            cb.addActionListener(this);
            getContentPane().add(cb);
        public void actionPerformed (ActionEvent e) {
            System.out.println("action!");
        public static void main (String[] argv) {
            Forum3 test = new Forum3();
            test.setSize(300,200);
            test.setVisible(true);
    }If you start this program (I am also using Windows XP), you see the JFrame window including the JComboBox. "item 1" is selected by default. If you click again on "item 1", no event will be fired. An event will be fired only, if you choose "item 2" or "item 3". You can try this with any other of the given items. An event will be only fired, if you choose a different item than the last one.
    What I need, is a routine that fires an event each time any item is selected!
    I would be grateful for a helpful hint, how to solve this in a "clean" way :-)

  • JComboBox not visually updating after setSelectedItem

    Hi there,
    I'm having a strange problem wherein I have a JComboBox item, I call setSelectedItem, and visually the control does not update. It will update if I drag the window wider or move my mouse over it, but not immediately after the call. Isn't there some sort of hookup already there such that calling setSelectedItem should automatically update the combo box visually? What am I missing? Do I have to call some sort of repaint on the control after setting the selected item, or have I done something improperly?
    Thanks in advance for any help you can provide me with -- this is driving me nuts!
    Edited by: aardvarkk on Nov 10, 2010 7:21 PM

    aardvarkk wrote:
    I thought perhaps the problem was that I was reusing a ComboBoxModel across several combo boxes. I've since fixed that problem, however, and the repainting is not taking place correctly. Note that if I simply write:
    tagComboBox.setSelectedItem(tagAgg);
    tagComboBox.repaint();
    it works as I would expect. However, when I remove the call to repaint(), I have to mouse over the combo box before it shows me its 'actual' value. It may or may not be important that I'm using the Nimbus LAF?The best way to find out is to run the program with another LaF.
    Why would a repaint be necessary here if I'm making the call to setSelectedItem from the EDT?It shouldn't be necessary.
    db

  • JComboBox popup list remains open after losing keyboard focus

    Hi,
    I have noticed a strange JComboBox behavior. When you click on the drop down arrow to show the popup list, and then press the Tab key, the keyboard focus moves to the next focusable component, but the popup list remains visible.
    I have included a program that demonstrates the behavior. Run the program, click the drop down arrow, then press the Tab key. The cursor will move into the JTextField but the combo box's popup list is still visible.
    Does anyone know how I can change this???
    Thanks for any help or ideas.
    --Yeath
    import java.awt.*;
    import javax.swing.*;
    import java.util.*;
    public class Test extends JFrame
       public Test()
          super( "Test Application" );
          this.getContentPane().setLayout( new BorderLayout() );
          Box box = Box.createHorizontalBox();
          this.getContentPane().add( box, BorderLayout.CENTER );
          Vector<String> vector = new Vector<String>();
          vector.add( "Item" );
          vector.add( "Another Item" );
          vector.add( "Yet Another Item" );
          JComboBox jcb = new JComboBox( vector );
          jcb.setEditable( true );
          JTextField jtf = new JTextField( 10 );
          box.add( jcb );
          box.add( jtf );
       public static void main( String[] args )
          Test test = new Test();
          test.pack();
          test.setVisible( true );
          test.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    }

    ran your code on 1.5.0_3, observed problem as stated.
    even though the cursor is merrily blinking in the textfield, you have to click into
    the textfield to dispose the dropdown
    ran your code on 1.4.2_08, no problems at all - tabbing into textfield immediately
    disposed the dropdown
    another example of 'usual' behaviour (involving focus) breaking between 1.4 and 1.5
    the problem is that any workaround now, may itself be broken in future versions

  • Indent sales - reject item after performing GR

    Dear SD Gurus,
    I have a question on the reason for rejection for indent sales.
    Scenario as follows:
    1. Create sales order with sales lines using indent sales.
    2. PR automatically created. Released.
    3. PO is created. Released.
    4. GR performed for the PO (MIGO).
    5. Go back to Sales Order (in step 1) and reject all the sales line with reason for rejection.
    6. System will prompt warning saying that PO exist. Still allowed to save.
    Let's say the user accidentally rejected the items and now wants to remove the reason for rejection. System will not allowed and give the error:
    Delete purchase order 4500019050 and item 000010 first
    You can only reject an order item in third-party order processing once the purchase order item has been deleted. When you delete it, you should also ensure that the vendor delivers the goods directly to the customer if the order has not been rejected.
    If you cannot delete the purchase order, then you should not reject the sales order because the goods have probably reached the customer and should then be billed. At this point, the customer can no longer reject the order item.
    Any ideas on why the system behaves this way? I'm pretty sure this is standard SAP ... but I just want to know the reasoning behind the logic above.
    Thanks.

    Hi,
    Take the help of ABAP'er, and explain him that as soon as sales order is invoiced(partially), set the rejection reason to sales order.
    And also define the rejection reason and assign these rejection reasons to billing types.
    Regards
    Ashutosh

  • Can't render background color in JComboBox, after selection.

    I don't understand why this problem is so difficult. It is driving me nuts.
    If I create a renderer for a Jcombobox, it will correctly render TEXT and COLOR if it is displaying it in the pop up list, but as soon as it has been selected, the combo will render TEXT correctly but will ignore COLOR. I have tried playing around with opacity and with the editors, but it just seems as if JComboBox renderers do not work 100% as expected.
    Here is my text code. All I want is for the color of X or Y to be reflected in the selected element :
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import javax.swing.DefaultListCellRenderer;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JList;
    import javax.swing.JPanel;
    public class CustomComboBoxDemo extends JPanel {
        public CustomComboBoxDemo() {
            super(new BorderLayout());
            String[] s = { "1", "2", "3", "4", "5" };
            JComboBox c = new JComboBox(s);
            JComboBox c2 = new JComboBox(s);
            c.setOpaque(true);
            ComboBoxRenderer renderer= new ComboBoxRenderer();
            c.setRenderer(renderer);
            c2.setRenderer(renderer);
            JPanel p = new JPanel();
            p.add(c);
            p.add(c2);
            add(p);
        class ComboBoxRenderer extends DefaultListCellRenderer {
            public ComboBoxRenderer() {
                setOpaque(true);
            public Component getListCellRendererComponent(
                                               JList list,
                                               Object value,
                                               int index,
                                               boolean isSelected,
                                               boolean cellHasFocus) {
                 JLabel c = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
                 if (value.toString().equals("3")) {
                     c.setText("X");
                     c.setBackground(Color.RED);
                 } else {
                     c.setText("Y");
                     c.setBackground(Color.GREEN);
                 return this;
        public static void main(String[] args) {
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
        private static void createAndShowGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame("CustomComboBoxDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setContentPane(new CustomComboBoxDemo());
            //Display the window.
            frame.pack();
            frame.setVisible(true);
    }

    I think the problem has to do with the Alloy look and feel. If I use the Systsem look and feel then the setBackground() method does not colour in the button (just the textfield)
    This has fixed my initial problem :
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import javax.swing.DefaultListCellRenderer;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JList;
    import javax.swing.JPanel;
    import javax.swing.UIManager;
    import javax.swing.plaf.basic.BasicComboBoxEditor;
    public class CustomComboBoxDemo extends JPanel {
        public CustomComboBoxDemo() {
            super(new BorderLayout());
              try {
                   UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              } catch (Exception e) {
                   e.printStackTrace();
            String[] s = { "1", "2", "3", "4", "5" };
            JComboBox c = new JComboBox(s);
            JComboBox c2 = new JComboBox(s);
    //        c.setRenderer(aRenderer)
    //        c.getEditor().getEditorComponent().setBackground(Color.GREEN);
            c.setBackground(Color.pink);
            c2.setBackground(Color.pink);
    //        c2.setBackground(Color.black);
            c.setOpaque(true);
            c2.setOpaque(false);
            ComboBoxRenderer renderer= new ComboBoxRenderer();
            c.setRenderer(renderer);
            c2.setRenderer(renderer);
            JPanel p = new JPanel();
            p.add(c);
            p.add(c2);
            add(p);
        private class MyComboBoxEditor extends BasicComboBoxEditor{
             public Component getEditorComponent(){
                  Component comp = super.getEditorComponent();
                  comp.setBackground(Color.red);
                  return comp;
        class ComboBoxRenderer extends DefaultListCellRenderer {
            public ComboBoxRenderer() {
                setOpaque(true);
            public Component getListCellRendererComponent(
                                               JList list,
                                               Object value,
                                               int index,
                                               boolean isSelected,
                                               boolean cellHasFocus) {
                 JLabel c = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
    //             setForeground(Color.green);
    //             setBackground(Color.black);
    //             list.setForeground(Color.green);
    //             list.setBackground(Color.black);
                 if (value.toString().equals("3")) {
                     c.setText("X");
                     c.setBackground(Color.RED);
                 } else {
                     c.setText("Y");
                     c.setBackground(Color.GREEN);
                 return this;
        public static void main(String[] args) {
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
        private static void createAndShowGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame("CustomComboBoxDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setContentPane(new CustomComboBoxDemo());
            //Display the window.
            frame.pack();
            frame.setVisible(true);
    }

Maybe you are looking for

  • How to retrieve DN from client certificate in servlet

    Hello, My servlet has to use SSL, and authenticate users based on the owner of a client certificate. Is there a way for my servlet to obtain the session's client certificate and extract the owner's DN from it? Thanks!

  • ID on ipad mini

    for some reason my iPad if logged into my wives ID, my problem if i can't log in with my ID tried changing by logging out of iTunes and store setting and logging back in still my wives ID pops out and she has no clue what her ID is. Please can someon

  • OBIEE 11g: Bugs Fixed in 11.1.1.6.5 Patch Set

    Hello, I have a question about the patches that apply. I have installed the product BI Publisher Enterprise 11g (11.1.1.6.0) I detected a bug: bug 13791065 - UNGROUP OF A SUBGROUP WITH AN EXPRESSION DOES NOT WORK PROPERLY This bug was fixed in OBIEE

  • Bw 7.0 v/s 3.5 urgent

    hi all,         presently i am working in bw 3.5 but our company upgraded from bw 3.5 to bw 7.0 there for i don't no about the procedure for creating 1. DataSource 2. InfoPackage. 3.Datatargets 4 transformations rules 5. DTP i just create data source

  • I never updated my macbook air 8.1, and I can't find it anywhere. What do I do?

    My operating system is 7.0.4, I want to update to the new mavericks, but my compter says I need to update to 8.1 before I can do that. However, I cannot find 8.1 anywhere, what should I do?