Padding on combo box

I am trying to increase the top and bottom spacing on button and combo box type components using CSS, assuming that the same font and font size is used then I would like the components to all be the same height. However, I have run into a couple of difficulties.
Firstly, I can't find a way to pad combo box and choice components. The following CSS will size the combo box correctly but push down the selected cell text.
.combo-box .list-cell {
-fx-padding: 6 6 6 6;
Padding around the arrow button doesn't seem to work either. Secondly, adding a graphic node to a button or menu button increases it's size by 2 pixels. Am I missing a property somewhere?
The current CSS can be found at: https://github.com/JFXtras/jfxtras-styles/blob/master/src/brume/brume.css
Many Thanks
Andy

I am trying to set the height as part of the skin so no extra changes are needed. Some controls allow it but combo box doesn't seem to, wondering if the other controls allow it by coincident but this isn't the intention for CSS.

Similar Messages

  • How to populate data in the data table on combo box change event

    hi
    i am deepak .
    i am very new to JSF.
    my problem is i want to populate data in the datatable on the combo box change event.
    for example ---
    combo box has name of the city. when i will select a city
    the details of the city should populate in the datatable. and if i will select another city then the datatable should change accordingly..
    its urgent
    reply as soon as possible
    thanks in advance

    i am using Rational Application Developer to develop my application.
    i am using a combo box and i am assigning cityName from the SDO.
    and i am declaring a variable in the pageCode eg.
    private String cityName;
    public void setCityName(String cityName){
    this.cityName = cityName;
    public String getCityName(){
    return cityName;
    <h:selectOneMenu id="menu1" styleClass="selectOneMenu" value="#{pc_Test1.loginID}" valueChangeListener="#{pc_Test1.handleMenu1ValueChange}">
                        <f:selectItems
                             value="#{selectitems.pc_Test1.usercombo.LOGINID.LOGINID.toArray}" />
                   </h:selectOneMenu>
                   <hx:behavior event="onchange" target="menu1" behaviorAction="get"
                        targetAction="box1"></hx:behavior>
    and also i am declaring a requestParam type variable named city;
    and at the onChangeEvent i am writing the code
    public void handleMenu1ValueChange(ValueChangeEvent valueChangedEvent) {
    FacesContext context = FacesContext.getCurrentInstance();
    Map requestScope = ext.getApplication().createValueBinding("#{requestScope}").getValue(context);
    requestScope.put("login",(String)valueChangedEvent.getNewValue());
    and also i am creating another SDO which is used to populate data in datatable and in this SDO in the where clause i am using that requestParam .
    it is assigning value in the pageCode variable and in the requestParam but it is not populating the dataTable. i don't no why??
    it is possible that i may not clear at this point.
    please send me the way how my problem can be solved.
    thanks in advance

  • How to Bind a Combo Box so that it retrieves and display content corresponding to the Id in a link table and populates itself with the data in the main table?

    I am developing a desktop application in Wpf using MVVM and Entity Frameworks. I have the following tables:
    1. Party (PartyId, Name)
    2. Case (CaseId, CaseNo)
    3. Petitioner (CaseId, PartyId) ............. Link Table
    I am completely new to .Net and to begin with I download Microsoft's sample application and
    following the pattern I have been successful in creating several tabs. The problem started only when I wanted to implement many-to-many relationship. The sample application has not covered the scenario where there can be a any-to-many relationship. However
    with the help of MSDN forum I came to know about a link table and managed to solve entity framework issues pertaining to many-to-many relationship. Here is the screenshot of my application to show you what I have achieved so far.
    And now the problem I want the forum to address is how to bind a combo box so that it retrieves Party.Name for the corresponding PartyId in the Link Table and also I want to populate it with Party.Name so that
    users can choose one from the dropdown list to add or edit the petitioner.

    Hello Barry,
    Thanks a lot for responding to my query. As I am completely new to .Net and following the pattern of Microsoft's Employee Tracker sample it seems difficult to clearly understand the concept and implement it in a scenario which is different than what is in
    the sample available at the link you supplied.
    To get the idea of the thing here is my code behind of a view vBoxPetitioner:
    <UserControl x:Class="CCIS.View.Case.vBoxPetitioner"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:v="clr-namespace:CCIS.View.Case"
    xmlns:vm="clr-namespace:CCIS.ViewModel.Case"
    mc:Ignorable="d"
    d:DesignWidth="300"
    d:DesignHeight="200">
    <UserControl.Resources>
    <DataTemplate DataType="{x:Type vm:vmPetitioner}">
    <v:vPetitioner Margin="0,2,0,0" />
    </DataTemplate>
    </UserControl.Resources>
    <Grid>
    <HeaderedContentControl>
    <HeaderedContentControl.Header>
    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
    <TextBlock Margin="2">
    <Hyperlink Command="{Binding Path=AddPetitionerCommand}">Add Petitioner</Hyperlink>
    | <Hyperlink Command="{Binding Path=DeletePetitionerCommand}">Delete</Hyperlink>
    </TextBlock>
    </StackPanel>
    </HeaderedContentControl.Header>
    <ListBox BorderThickness="0" SelectedItem="{Binding Path=CurrentPetitioner, Mode=TwoWay}" ItemsSource="{Binding Path=tblParties}" />
    </HeaderedContentControl>
    </Grid>
    </UserControl>
    This part is working fine as it loads another view that is vPetioner perfectly in the manner I want it to be.
    Here is the code of vmPetitioner, a ViewModel:
    Imports Microsoft.VisualBasic
    Imports System.Collections.ObjectModel
    Imports System
    Imports CCIS.Model.Party
    Namespace CCIS.ViewModel.Case
    ''' <summary>
    ''' ViewModel of an individual Email
    ''' </summary>
    Public Class vmPetitioner
    Inherits vmParty
    ''' <summary>
    ''' The Email object backing this ViewModel
    ''' </summary>
    Private petitioner As tblParty
    ''' <summary>
    ''' Initializes a new instance of the EmailViewModel class.
    ''' </summary>
    ''' <param name="detail">The underlying Email this ViewModel is to be based on</param>
    Public Sub New(ByVal detail As tblParty)
    If detail Is Nothing Then
    Throw New ArgumentNullException("detail")
    End If
    Me.petitioner = detail
    End Sub
    ''' <summary>
    ''' Gets the underlying Email this ViewModel is based on
    ''' </summary>
    Public Overrides ReadOnly Property Model() As tblParty
    Get
    Return Me.petitioner
    End Get
    End Property
    ''' <summary>
    ''' Gets or sets the actual email address
    ''' </summary>
    Public Property fldPartyId() As String
    Get
    Return Me.petitioner.fldPartyId
    End Get
    Set(ByVal value As String)
    Me.petitioner.fldPartyId = value
    Me.OnPropertyChanged("fldPartyId")
    End Set
    End Property
    End Class
    End Namespace
    And below is the ViewMode vmParty which vmPetitioner Inherits:
    Imports Microsoft.VisualBasic
    Imports System
    Imports System.Collections.Generic
    Imports CCIS.Model.Case
    Imports CCIS.Model.Party
    Imports CCIS.ViewModel.Helpers
    Namespace CCIS.ViewModel.Case
    ''' <summary>
    ''' Common functionality for ViewModels of an individual ContactDetail
    ''' </summary>
    Public MustInherit Class vmParty
    Inherits ViewModelBase
    ''' <summary>
    ''' Gets the underlying ContactDetail this ViewModel is based on
    ''' </summary>
    Public MustOverride ReadOnly Property Model() As tblParty
    '''' <summary>
    '''' Gets the underlying ContactDetail this ViewModel is based on
    '''' </summary>
    'Public MustOverride ReadOnly Property Model() As tblAdvocate
    ''' <summary>
    ''' Gets or sets the name of this department
    ''' </summary>
    Public Property fldName() As String
    Get
    Return Me.Model.fldName
    End Get
    Set(ByVal value As String)
    Me.Model.fldName = value
    Me.OnPropertyChanged("fldName")
    End Set
    End Property
    ''' <summary>
    ''' Constructs a view model to represent the supplied ContactDetail
    ''' </summary>
    ''' <param name="detail">The detail to build a ViewModel for</param>
    ''' <returns>The constructed ViewModel, null if one can't be built</returns>
    Public Shared Function BuildViewModel(ByVal detail As tblParty) As vmParty
    If detail Is Nothing Then
    Throw New ArgumentNullException("detail")
    End If
    Dim e As tblParty = TryCast(detail, tblParty)
    If e IsNot Nothing Then
    Return New vmPetitioner(e)
    End If
    Return Nothing
    End Function
    End Class
    End Namespace
    And final the code behind of the view vPetitioner:
    <UserControl x:Class="CCIS.View.Case.vPetitioner"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:vm="clr-namespace:CCIS.ViewModel.Case"
    mc:Ignorable="d"
    Width="300">
    <UserControl.Resources>
    <ResourceDictionary Source=".\CompactFormStyles.xaml" />
    </UserControl.Resources>
    <Grid>
    <Border Style="{StaticResource DetailBorder}">
    <Grid>
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="Auto" />
    <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
    <TextBlock Grid.Column="0" Text="Petitioner:" />
    <ComboBox Grid.Column="1" Width="240" SelectedValuePath="." SelectedItem="{Binding Path=tblParty}" ItemsSource="{Binding Path=PetitionerLookup}" DisplayMemberPath="fldName" />
    </Grid>
    </Border>
    </Grid>
    </UserControl>
    The problem, presumably, seems to be is that the binding path "PetitionerLookup" of the ItemSource of the Combo box in the view vPetitioner exists in a different ViewModel vmCase which serves as an ObservableCollection for MainViewModel. Therefore,
    what I need to Know is how to route the binding path if it exists in a different ViewModel?
    Sir, I look forward to your early reply bringing a workable solution to the problem I face. 
    Warm Regards,
    Arun

  • Not able to populate data in the combo box

    Hi Guys,
    I m new to flex development and I want to populate the data
    coming from the databasein the combobox.I am able to get the length
    .but not able to populate the data.
    Can anyone helpme out?
    The code is below:
    The data displayed in the combox box is displayed as
    [object],[object] etc.I m sure that the data is coming from the
    database and its not populated in the combo box.any help is
    appreciated.
    private function getParkinfo(event:ResultEvent):void
    { Alert.show(event.result.length.toString());
    countries.dataProvider = event.result;
    <mx:ComboBox id="countries" />

    What does the data look like in the result? Is it XML? Post a
    sample of it.

  • Display data in list and combo box

    hi all....
    how to display data from database in list and combo box? i use MYSQL...
    help me please..... tq...

    1 - Write a query to retrieve the data you want from database
    2 - In a servlet, connect to database, Run the query, scroll through the result set and put the data into a list of Java Objects.
    3 - Set a request/session attribute of that list of objects
    4 - Forward to JSP
    5 - In JSP, create a <select> box, and then use a <c:forEach> loop to generate <option> tags from the list.

  • Show text box from one combo box selection

    Total newb here and need help.  I tried searching for a javascript to copy/paste, but without any luck.  I am using Acrobat Pro 9.2.0.  If you could help me out with the javascript or with directions on how to make the following be accomplished, I would be greatly appreciative.
    I am creating a fillable PDF and currently have a combo box that is labeled "Internship Satisfied By" with the options of "TCoB PDP", "MRKTNG 4185", and "Other College".  I would like a hidden text box (where the end user can fill in to explain) to become visible only when the end user selects the "Other College" option, but stay hidden for the other selections.  The hidden text box is labeled "Internship Explained".
    Thanks in advance! Jarrod

    Use this code as the combo box's validation script:
    if (event.value == "Other College") {
    getField("Internship Explained").display = display.visible;
    } else {
    getField("Internship Explained").display = display.hidden;

  • Adding an event listener to combo box

    I am working on a mortgage calculator and I cannot figure out how to add an event listener to a combo box.
    I want to get the mortgage term and interest rate to calucate the mortgage using the combo cox. Here is my program.
    Modify the mortgage program to allow the user to input the amount of a mortgage
    and then select from a menu of mortgage loans: 7 year at 5.35%, 15 year at 5.50%, and
    30 year at 5.75%. Use an array for the different loans. Display the mortgage payment
    amount. Then, list the loan balance and interest paid for each payment over the term
    of the loan. Allow the user to loop back and enter a new amount and make a new
    selection, with resulting new values. Allow user to exit if running as an application
    (can't do that for an applet though).
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.text.NumberFormat;
    import java.util.Locale;
    //creates class MortgageCalculator
    public class MortgageCalculator extends JFrame implements ActionListener {
    //creates title for calculator
         JPanel row = new JPanel();
         JLabel mortgageCalculator = new JLabel("MORTGAGE CALCULATOR", JLabel.CENTER);
    //creates labels and text fields for amount entered          
         JPanel firstRow = new JPanel(new GridLayout(3,1,1,1));
         JLabel mortgageLabel = new JLabel("Mortgage Payment $", JLabel.LEFT);
         JTextField mortgageAmount = new JTextField(10);
         JPanel secondRow = new JPanel();
         JLabel termLabel = new JLabel("Mortgage Term/Interest Rate", JLabel.LEFT);
         String[] term = {"7", "15", "30"};
         JComboBox mortgageTerm = new JComboBox(term);
         JPanel thirdRow = new JPanel();
         JLabel interestLabel = new JLabel("Interest Rate (%)", JLabel.LEFT);
         String[] interest = {"5.35", "5.50", "5.75"};
         JComboBox interestRate = new JComboBox(interest);
         JPanel fourthRow = new JPanel(new GridLayout(3, 2, 10, 10));
         JLabel paymentLabel = new JLabel("Monthly Payment $", JLabel.LEFT);
         JTextField monthlyPayment = new JTextField(10);
    //create buttons to calculate payment and clear fields
         JPanel fifthRow = new JPanel(new GridLayout(3, 2, 1, 1));
         JButton calculateButton = new JButton("CALCULATE PAYMENT");
         JButton clearButton = new JButton("CLEAR");
         JButton exitButton = new JButton("EXIT");
    //Display area
         JPanel sixthRow = new JPanel(new GridLayout(2, 2, 10, 10));
         JLabel displayArea = new JLabel(" ", JLabel.LEFT);
         JTextArea textarea = new JTextArea(" ", 8, 50);
    public MortgageCalculator() {
         super("Mortgage Calculator");                     //title of frame
         setSize(550, 350);                                             //size of frame
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         Container pane = getContentPane();
         GridLayout grid = new GridLayout(7, 3, 10, 10);
         pane.setLayout(grid);
         pane.add(row);
         pane.add(mortgageCalculator);
         pane.add(firstRow);
         pane.add(mortgageLabel);
         pane.add(mortgageAmount);
         pane.add(secondRow);
         pane.add(termLabel);
         pane.add(mortgageTerm);
         pane.add(thirdRow);
         pane.add(interestLabel);
         pane.add(interestRate);
         pane.add(fourthRow);
         pane.add(paymentLabel);
         pane.add(monthlyPayment);
         monthlyPayment.setEnabled(false);
         pane.add(fifthRow);
         pane.add(calculateButton);
         pane.add(clearButton);
         pane.add(exitButton);
         pane.add(sixthRow);
         pane.add(textarea); //adds texaarea to frame
         pane.add(displayArea);
         setContentPane(pane);
         setVisible(true);
         //Adds Listener to buttons
         calculateButton.addActionListener(this);
         clearButton.addActionListener(this);
         exitButton.addActionListener(this);
         mortgageTerm.addActionListener(this);
         interestRate.addActionListener(this);
    public void actionPerformed(ActionEvent event) { 
         Object command = event.getSource();
         JComboBox mortgageTerm = (JComboBox)event.getSource();
         String termYear = (String)mortgageTerm.getSelectedItem();
    if (command == calculateButton) //calculates mortgage payment
         int year = Integer.parseInt(mortgageTerm.getText());
         double rate = new Double(interestRate.getText()).doubleValue();
         double mortgage = new Double(mortgageAmount.getText()).doubleValue();
         double interest = rate /100.0 / 12.0;
         double monthly = mortgage *(interest/(1-Math.pow(interest+1,-12.0 * year)));
                   NumberFormat myCurrencyFormatter;
                   myCurrencyFormatter = NumberFormat.getCurrencyInstance(Locale.US);
                   monthlyPayment.setText(myCurrencyFormatter.format(monthly));
         if(command == clearButton) //clears all text fields
                   mortgageAmount.setText(null);
                   //mortgageTerm.setText(null);
                   //interestRate.setText(null);
                   monthlyPayment.setText(null);
              if(command == exitButton) //sets exit button
                        System.exit(0);
         public static void main(String[] arguments) {
              MortgageCalculator mor = new MortgageCalculator();

    The OP already did this to both JComboBoxes.
    mochatay, here is a new actionPerformed method for you to use.
    I've improved a few things here and there...
    1) You can't just cast the ActionEvent's source into a JComboBox!
    What if it was a JButton that fired the event? Then you would get ClassCastExceptions (I'm sure you did)
    So check for all options, what the source of the ActionEvent actually was...
    2) You can't assume the user will always type in valid data.
    So enclose the Integer and Double parse methods in try-catch brakcets.
    Then you can do something when you know that the user has entered invalid input
    (like tell him/her what a clumsy idiot they are !)
    3) As soon as user presses an item in any JComboBox, just re-calculate.
    I did this here by programmatically clicking the 'Calculate' button.
    Alternatively, you could have a 'calculate' method, which does everything inside the
    if(command==calculateButton) if-block.
    This will be called when:
    a)calculateButton is pressed
    b)when either of the JComboBoxes are pressed.
    public void actionPerformed (ActionEvent event)
            Object command = event.getSource ();
            if (command == calculateButton) //calculates mortgage payment
                int year = 0;
                double rate = 0;
                double mortgage = 0;
                double interest = 0;
                /* If user has input invalid data, tell him so
                and return (Exit from this method back to where we were before */
                try
                    year = Integer.parseInt (mortgageTerm.getSelectedItem ().toString ());
                    rate = new Double (interestRate.getSelectedItem ().toString ()).doubleValue ();
                    mortgage = new Double (mortgageAmount.getText ()).doubleValue ();
                    interest = rate / 100.0 / 12.0;
                catch (NumberFormatException nfe)
                    /* Display a message Dialogue box with a message */
                    JOptionPane.showMessageDialog (this, "Error! Invalid input!");
                    return;
                double monthly = mortgage * (interest / (1 - Math.pow (interest + 1, -12.0 * year)));
                NumberFormat myCurrencyFormatter;
                myCurrencyFormatter = NumberFormat.getCurrencyInstance (Locale.US);
                monthlyPayment.setText (myCurrencyFormatter.format (monthly));
            else if (command == clearButton) //clears all text fields
                /* Better than setting it to null (I think) */
                mortgageAmount.setText ("");
                //mortgageTerm.setText(null);
                //interestRate.setText(null);
                monthlyPayment.setText ("");
            else if (command == exitButton) //sets exit button
                System.exit (0);
            else if (command == mortgageTerm)
                /* Programmatically 'clicks' the button,
                As is user had clicked it */
                calculateButton.doClick ();
            else if (command == interestRate)
                calculateButton.doClick ();
            //JComboBox mortgageTerm = (JComboBox) event.getSource ();
            //String termYear = (String) mortgageTerm.getSelectedItem ();
        }Hope this solves your problems.
    I also hope you'll be able to learn from what I've indicated, so you can use similar things yourself
    in future!
    Regards,
    lutha

  • How to get the values from xml file to java combo box

    Hi frens,
    I am new to java and xml programming,
    Now, i want to have a code of getting the tag values from the xml file
    into the swing combo box of java front end.
    How can we do that?
    any help of code or tutorial or an ebook is a great help for me.
    Thank you,
    Karthik.
    Edited by: Karthik84 on Aug 27, 2008 1:49 AM
    Edited by: Karthik84 on Aug 27, 2008 11:29 PM

    look at this link
    http://www.stylusstudio.com/docs/v2006/d_help30.html
    I read sometime back that castor has a tool to do
    conversion. You might have a look into casto as well.

  • Retrieve all values from project type when project type combo box is null

    Hi,
    We are facing a tight situation here. We have a scenario where we have 2 filter options.
    1) Department ID
    2) Project type
    When department ID is selected all the department IDs should be populated in the combo box and the project type combo box should be empty.
    Similarly, when project type is selected all the project types should be populated in the combo box and the department ID combo box should be empty.
    Then, when more than one value is selected from department ID box and all the values from project type must be retrieved from query level (as per business logic).
    How do we do this? Kindly help us with this situation.

    Basically my situation slightly different.
    I am trying to do a bulk insert on SQL Server table using prepared statement, during that time i am getting the exception. I am using JDBC-ODBC driver. However, if i do individual record insertion, it is working.
    Any idea about this type of problem ?
    Regards
    Ramesh

  • How can I make the combo box turn to the value of black.

    When the show button is pressed (and not before), a filled black square should be
    displayed in the display area. The combo box (or drop down list) that enables the user to choose the colour of
    the displayed shape and the altering should take effect immediately.When the show button is pressed,
    the image should immediately revert to the black square, the combo box should show the value that
    correspond to the black.
    Now ,the problem is: after I pressed show button, the image is reverted to the black square,but I don't know
    how can I make the combo box turn to the value of black.
    Any help or hint?Thanks a lot!
    coding 1.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class test extends JFrame {
         private JPanel buttonPanel;
         private DrawPanel myPanel;
         private JButton showButton;
         private JComboBox colorComboBox;
    private boolean isShow;
         private int shape;
         private boolean isFill=true;
    private String colorNames[] = {"black", "blue", "cyan", "darkGray", "gray",
    "green", "lightgray", "magenta", "orange",
    "pink", "red", "white", "yellow"}; // color names list in ComboBox
    private Color colors[] = {Color.black, Color.blue, Color.cyan, Color.darkGray,
                              Color.gray, Color.green, Color.lightGray, Color.magenta,
                              Color.orange, Color.pink, Color.red, Color.white, Color.yellow};
         public test() {
         super("Draw Shapes");
         // creat custom drawing panel
    myPanel = new DrawPanel(); // instantiate a DrawPanel object
    myPanel.setBackground(Color.white);
         // set up showButton
    // register an event handler for showButton's ActionEvent
    showButton = new JButton ("show");
         showButton.addActionListener(
              // anonymous inner class to handle showButton events
         new ActionListener() {
                   // draw a black filled square shape after clicking showButton
         public void actionPerformed (ActionEvent event) {
                             // call DrawPanel method setShowStatus and pass an parameter
              // to decide if show the shape
         myPanel.setShowStatus(true);
                   isShow = myPanel.getShowStatus();
                                            shape = DrawPanel.SQUARE;
                        // call DrawPanel method setShape to indicate shape to draw
                                            myPanel.setShape(shape);
                        // call DrawPanel method setFill to indicate to draw a filled shape
                                            myPanel.setFill(true);
                        // call DrawPanel method draw
                                            myPanel.draw();
                             myPanel.setFill(true);
                             myPanel.setForeground(Color.black);
                   }// end anonymous inner class
         );// end call to addActionListener
    // set up colorComboBox
    // register event handlers for colorComboBox's ItemEvent
    colorComboBox = new JComboBox(colorNames);
    colorComboBox.setMaximumRowCount(5);
    colorComboBox.addItemListener(
         // anonymous inner class to handle colorComboBox events
         new ItemListener() {
         // select shape's color
         public void itemStateChanged(ItemEvent event) {
         if(event.getStateChange() == ItemEvent.SELECTED)
         // call DrawPanel method setForeground
         // and pass an element value of colors array
         myPanel.setForeground(colors[colorComboBox.getSelectedIndex()]);
    myPanel.draw();
    }// end anonymous inner class
    ); // end call to addItemListener
    // set up panel containing buttons
         buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridLayout(4, 1, 0, 50));
         buttonPanel.add(showButton);
    buttonPanel.add(colorComboBox);
    JPanel radioButtonPanel = new JPanel();
    radioButtonPanel.setLayout(new GridLayout(2, 1, 0, 20));
    Container container = getContentPane();
    container.setLayout(new BorderLayout(10,10));
    container.add(myPanel, BorderLayout.CENTER);
         container.add(buttonPanel, BorderLayout.EAST);
    setSize(500, 400);
         setVisible(true);
         public static void main(String args[]) {
         test application = new test();
         application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    coding 2
    import java.awt.*;
    import javax.swing.*;
    public class DrawPanel extends JPanel {
         public final static int CIRCLE = 1, SQUARE = 2;
         private int shape;
         private boolean fill;
         private boolean showStatus;
    private int shapeSize = 100;
    private Color foreground;
         // draw a specified shape
    public void paintComponent (Graphics g){
              super.paintComponent(g);
              // find center
    int x=(getSize().width-shapeSize)/2;
              int y=(getSize().height-shapeSize)/2;
              if (shape == CIRCLE) {
         if (fill == true){
         g.setColor(foreground);
              g.fillOval(x, y, shapeSize, shapeSize);
    else{
                   g.setColor(foreground);
    g.drawOval(x, y, shapeSize, shapeSize);
              else if (shape == SQUARE){
         if (fill == true){
         g.setColor(foreground);
                        g.fillRect(x, y, shapeSize, shapeSize);
    else{
                        g.setColor(foreground);
    g.drawRect(x, y, shapeSize, shapeSize);
    // set showStatus value
    public void setShowStatus (boolean s) {
              showStatus = s;
         // return showstatus value
    public boolean getShowStatus () {
              return showStatus;
         // set fill value
    public void setFill(boolean isFill) {
              fill = isFill;
         // set shape value
    public void setShape(int shapeToDraw) {
              shape = shapeToDraw;
    // set shapeSize value
    public void setShapeSize(int newShapeSize) {
              shapeSize = newShapeSize;
    // set foreground value
    public void setForeground(Color newColor) {
              foreground = newColor;
         // repaint DrawPanel
    public void draw (){
              if(showStatus == true)
              repaint();

    Hello,
    does setSelectedIndex(int anIndex)
    do what you need?
    See Java Doc for JComboBox.

  • Combo box with bind variable from popup

    Hi.
    I had two comboboxes on a form, one having a bind variable. It works great, with the first one as bind field.
    But i want to have the first LOV to be a POPUP. So, the second LOV (combo box) needs to be refreshed when a user has picked a value from the popup list. When i do that, the second LOV is not refresehed...
    Is there a way to do this?
    (3.0.9.8.3.A)

    Hi,
    This was a bug and is fixed in 30984.
    Thanks,
    Sharmila

  • Difference between Combo Box and Dropdown List

    Hi All,
    I would like to know the difference between the elements 'Combo box' and 'Dropdown List' in VC. I am facing an issue where i am invoking an entry list and the output of the first element the entry list returns is getting reflected as the output for all the elements...
    So even if 2nd and 3rd row of the o/p from the entry list is giving only 2 items, if the 1st row returns only 1 then we are able to see only 1 item. Its as if the 1st row decides the items to be returned for all the rows.
    Please help.

    Hi Hezi,
    I have 2 columns in my table. First column is 'material number' and the 2nd one is 'production version'. There can 1,2 or 3 production version for each material. [This information is stored in the backend] This is retrieved through a method which invokes a bapi which in turn retrieves from the backend.
    I have provided a dropdown list for the 'production version' column. Lets say there are 2 rows. Material 1 and material 2. Lets say material 1 has 1 production version and material 2 has 2 production version. So rightfully speaking i should have 1 option in the dropdown for material 1 and 2 for material 2.
    But what i seeing is only 1 option for both the materials. This is wrong.
    Is there something that can be done to ensure that each row reflects the correct no. of options in the dropdown?

  • How to change screen combo box value from a method?

    Hi,
    I have a screen that has a combo box and an ALV.
    the combo box has the line numbers of the data in the ALV.
    you can select the line item and then the ALV changes...
    I fill the combo with function VRM_SET_VALUE.
    all is good once the user changes the combo box.
    I want to enable the user to click (hotspot) on ALV and then to ... and to change the value of the combo box to the line number he clicked on.
    I couldn't change the value inside that box.
    The combo box is declared as global parameter.
    when I assign a value to it inside the method, it is good. but once back to PAI, it is the old value.
    Do you have any idea how to set up that value?
    Thanks.

    Itay,
    When you load the combo box, you should be setting a "key" for each entry in the combo box.
    See below:
      move '2010FY' to Value-Key.
      move '2010 - Full Year' to Value-Text.
      append value to list.
      move '2010Q1' to Value-Key.
      move '2010 - Q1' to Value-Text.
      append value to list.
      move '2010Q2' to Value-Key.
      move '2010 - Q2' to Value-Text.
      append value to list.
      move '2010Q3' to Value-Key.
      move '2010 - Q3' to Value-Text.
      append value to list.
      move '2010Q4' to Value-Key.
      move '2010 - Q4' to Value-Text.
      append value to list.
      move 'COMBO1' to name.  "name of Combo box in the screen
      call function 'VRM_SET_VALUES'
        exporting
          id = name
          values = list.
    So add these "keys" to a hidden column in the ALV grid.  Then .... when the user presses a hotspot, pass the value of the hidden column (for the selected row) into the COMBO1 box.
      move '2010'FY' into Combo1.  " if they selected Full Year of 2010

  • IPhone SDK - What is the equivalent of a combo box

    I have a screen where there are quite a few items which are of the multiple-choice type. In other platforms i use a combo box (pick lists) to do this.
    On the iPhone SDK the only thing that comes close is the UIPicketView which is ugly IMHO. it takes too much real estate and too heavy.
    Is this is the only control available now?
    Also does the UIPicker come with an associated control which will launch the picker? What i mean is on other platforms and on the web there is a text field with a button with a down arrow next to it. Clicking either on the text field or the down arrow drops the list down. Is there a similar control on the iPhone which when clicked launches the picker OR do i have to create a button or a custom view which will launch the picker?
    Thanks for reading this and for your feedback.
    -TRS

    I do not believe there is an equivalent of -D in the DB JVM, a possible solution is:
    Load a properties file into the DB using Loadjava, then open this file from your Java code using Properties.load(), then iterate the properties calling System.setProperty().
    Chris

  • How I can stop the combo box with list of values from fireing validations

    Hi I'm using Jdeveloper 11.1.2.3.0
    Using Hr Schema employees table
    I Display employees data in af:table
    and I make List Of values on Department_id filed to easy change the employee department
    and another one on Job_id filed
    and Imake them UI Hints as ( combo box with list of values ) in the employeesVO
    the problem is when I Select a value from department or jobs ( combo box with list of values )
    fires the entire filed validations for mandatory atributes
    Note : the af:table Property ( contedelivery) is set to (immediate )
    How I can stop the combo box with list of values from fireing validations

    check it out.,
    http://andrejusb.blogspot.in/2012/09/what-to-do-when-adf-editable-table.html

Maybe you are looking for