How to add lines in combobox?

I want to add very thick colored lines in this combobox so ..
how do i do that..
thanks
public class NewJFrame extends javax.swing.JFrame {
    /** Creates new form NewJFrame */
    public NewJFrame() {
        initComponents();      
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
    private void initComponents() {
        jComboBox1 = new javax.swing.JComboBox();
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().add(jComboBox1, java.awt.BorderLayout.NORTH);
        pack();
    // </editor-fold>
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new NewJFrame().setVisible(true);
    // Variables declaration - do not modify
    private javax.swing.JComboBox jComboBox1;
    // End of variables declaration
}

I am exaplaining the code here.Please check once again.
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Vector;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JSeparator;
import javax.swing.ListCellRenderer;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;
* @version 1.0 12/25/98
public class BlockComboBoxExample extends JFrame {
  final String SEPARATOR = "SEPARATOR";
  public BlockComboBoxExample() {
    super("Block ComboBox Example");
    String[][] str = { { "A", "B", "C" }, { "1", "2", "3" },
        { "abc", "def", "ghi" } };
    JComboBox combo = new JComboBox(makeVectorData(str));
    combo.setRenderer(new ComboBoxRenderer());
    combo.addActionListener(new BlockComboListener(combo));
    getContentPane().setLayout(new FlowLayout());
    getContentPane().add(combo);
    setSize(300, 100);
    setVisible(true);
/*This method makes a vector of data to be added to the combo box by iterating through the String array and after each element of array,the needSeparator is made true indicating a separator must be added*/
private Vector makeVectorData(String[][] str) {
    boolean needSeparator = false;
    Vector data = new Vector();
    for (int i = 0; i < str.length; i++) {
      if (needSeparator) {
        data.addElement(SEPARATOR);
      for (int j = 0; j < str.length; j++) {
data.addElement(str[i][j]);
needSeparator = true;
return data;
public static void main(String args[]) {
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch (Exception evt) {}
BlockComboBoxExample frame = new BlockComboBoxExample();
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
/*This class is used to render the elements in ComboBox.When adding elements it checks for Separator,and if it is SEPARATOR then it returns a JSeparator object,causing a separator to be added in combo box.*/
class ComboBoxRenderer extends JLabel implements ListCellRenderer {
JSeparator separator;
public ComboBoxRenderer() {
setOpaque(true);
setBorder(new EmptyBorder(1, 1, 1, 1));
separator = new JSeparator(JSeparator.HORIZONTAL);
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
String str = (value == null) ? "" : value.toString();
if (SEPARATOR.equals(str)) {
return separator;
if (isSelected) {
setBackground(list.getSelectionBackground());
setForeground(list.getSelectionForeground());
} else {
setBackground(list.getBackground());
setForeground(list.getForeground());
setFont(list.getFont());
setText(str);
return this;
class BlockComboListener implements ActionListener {
JComboBox combo;
Object currentItem;
BlockComboListener(JComboBox combo) {
this.combo = combo;
combo.setSelectedIndex(0);
currentItem = combo.getSelectedItem();
public void actionPerformed(ActionEvent e) {
String tempItem = (String) combo.getSelectedItem();
if (SEPARATOR.equals(tempItem)) {
combo.setSelectedItem(currentItem);
} else {
currentItem = tempItem;
Now you can use the same concept to add separator to ur combobox.

Similar Messages

  • Urjent-how to add line items in tcode-FBL3N

    Hi Experts,
      How to add line items customer, customer name,  vendor and vendor name in FBL3N.
    Thanks in advance.
    mahe
    Moderator message - Please do not use words like "urjent". Please ask a specific question. Please search the forum. This question has been asked and answered before. Post locked
    Edited by: Rob Burbank on Apr 29, 2009 11:27 AM
    Edited by: Rob Burbank on Apr 29, 2009 11:28 AM

    Hi,
    Check the BTE's:
    00001020     POST DOCUMENT:       Prior to final checks             SAMPLE_INTERFACE_00001020
    00001025     POST DOCUMENT:       Final checks completed       SAMPLE_INTERFACE_00001025
    00001030     POST DOCUMENT:       Posting of standard data     SAMPLE_INTERFACE_00001030
    00001050     POST DOCUMENT:       Accounting interface           SAMPLE_INTERFACE_00001050
    Thanks & Regards,
    Harish

  • How to add line itme to sto delivery.

    Sd gurus,
    how do i add line time to the delivery after adding line item to STO?
    Im sure for STO we can t add line itme right there in the delivery it self..right?
    Please give me information.
    vivek

    Hi Vivek,
    As per my knowledge we cannot add the new line item in the same delivey...
    Becoz Delivery is created in backround. there is no specific copy controls set to change..
    its better to create a new delivery...
    hope you understand
    Muthu

  • How to add line series dynamically to a line chart in flex?

    hi..i need to add line series dynamically to a line chart..depending on an array..the application is this..i have an array which stores the details of the users connected to an fmi server..the chart should display the bandwidth of each client..so the users should be added and removed from the chart dynamically...

    Hi
    1.I am giving you solution for dynamically adding values to the dropdown
    public void addValue( )  //Method Name in Component controller
        //@@begin addValue()
              IWDNodeInfo nodeinfo = wdContext.nodeNodeTestData().getNodeInfo();// Node should be map to the view's Node
              IWDAttributeInfo att = nodeinfo.getAttribute("VechileTypes");// Attribute by which dropdown in bound//
              IModifiableSimpleValueSet svSet = att.getModifiableSimpleType().getSVServices().getModifiableSimpleValueSet();
              svSet.put(wdContext.currentNodeTestDataElement().getInpAtt(),wdContext.currentNodeTestDataElement().getInpAtt());
        //@@end
    2.   wdThis.wdGetLangCompController().addValue(); // call this method in the point where u want to add values to the dropdown.

  • How to add line item to sales order item table?

    Kindly help me the with the below requirement .
    Add line item to sales order(va01) dynamically on click of button. The button is also custom created push button.
    In the above requirement I have added the pushbutton to va01 tcode. But when I click on that button I need to add line item to sales order item table.
    I tried a lot but I am not successful. If possible can u please help on this.
    Regards,
    Rachel

    Hi!
    It's quite easy even in the standard SAP to add a line item for a customer order, I don't think it worth to develop a new button for this.
    However if you wanted to add a line automatically, the you can do the following in the program MV45AFZZ, FORM USEREXIT_SAVE_DOCUMENT.
    You can use similar code, but with some modifications.
    DATA: lv_posnr.
    LOOP AT xvbap.
    MOVE xvbap-posnr TO lv_posnr.   "get the last posnr
    ENDLOOP.
    ADD 10 TO lv_posnr.
    MOVE 'XYZ' TO xvbap-matnr.   "enter your material number here
    MOVE lv_posnr TO xvbap-posnr.
    * fill additinal field data in XVBAP if necessary
    MOVE 'I' TO xvbap-updkz.                  "Insert line
    APPEND xvbap.
    Regards
    Tamá

  • How to add line in PE51

    Dear Experts,
    Need your help in case added new lines in PE51.
    i tried increasing max line no from pe51_checktab tcode as there is few additional field requirement from my client,  i changed the number accordingly in this tcode. but im not getting the effect of same in pe51.
    I tried doing it through background/ attribute as well, but not able to add line in the existing form.
    Request you to kindly help me for the same.
    Kindly help.
    Rgds,
    Aarti
    Edited by: aartikshirsagar on Dec 21, 2010 7:40 AM

    Aarti,
    When you see it from GUI you are not able to see the whole scree.
    Width of payslip is around '255' charecters so you can't see whole payslip in single screen.
    Whatever you did it might have effected but there is a change it is in next screen.
    Please scroll the screen or run payroll for one person with this slip and check.
    Warm Regads

  • How to add line breaks to output fixed width flat file

    0
    I need to create a Flat file without column headers, no comma separated values but each column will have a fixed starting position and a fixed length in the text file. For example, below is the text file to be created with six columns
    Column1  Column2   Column3     Column4  Column5      Column6
    abc          1             New emp      xxxx         xxxx           
    xxx
    Fixed starting position and a fixed lenth values for these columns as are below;
    Column1 : Starting Position -1, Fixed Length -4
    Column2 : Starting Position - 8, Fixed Length - 2
    Column3 : Starting Postion - 11, Fixed Length - 10
    Column4 : Starting Position -1, Fixed Length -5
    Column5 : Starting Position - 10, Fixed Length - 2
    Column6 : Starting Postion - 15, Fixed Length - 5
    The out put file each line have only 20 characters length.First 3 columns comes in first line and 4-6 columns comes in 2nd line.
    OUTPUT FILE:
    1234   89  11121314151617181920
    12345    1011          151617181920

    BOL says that:
    The Fixed width with row delimiters option is not available in the Flat File Connection Manager Editor.
    If necessary, you can emulate this option in the editor. To emulate this option, on the General page of the Flat File Connection Manager
    Editor, for Format, select Ragged right. Then on the Advanced page
    of the editor, add a new dummy column as the final column of data.
    More details steps:
    http://www.coderewind.com/2012/08/ssis-how-to-include-rowdelimiter-with-destination-flat-files/
    Below blog should make things clear:
    SSIS Flat File Export - "Fixed Width" vs "Ragged Right"
    -Vaibhav Chaudhari

  • How to add Line items to Accounting Doc

    Hi All,
    I want to capture the amount of inventory to a separate GL accounts while doing GR.
    Accounting Document should look like this:-
    Inventory a/c 1000 BSX
    GR/IR a/c           1000- WRX
    1New line a/c  1000
    2New line a/c    1000-
    How can we achieve this.
    Thanks.

    U can make use of purchase account and purchase offset account . In obyc assign the account to purchase account EIN and puchase offset account EKG.

  • How to add line break to UILabel or to UITextView

    How can I do it? \n is not working
    Thank you

    Aristarh wrote:
    ... in this case in debugger
    looks thinner and paler.
    I don't think the "thick" character you're seeing is a new line, '
    ' (0x0A). It might be a carriage return, '
    ' (0x0D), some other control char, or possibly the combination "
    ", which is seen on Windows systems.
    How can I replace my usual
    to thinner
    1) Identify the unknown char(s);
    2) Use a method such as [stringByReplacingOccurrencesOfString:withString:|http://developer.apple.com/ip hone/library/documentation/Cocoa/Reference/Foundation/Classes/NSStringClass/Reference/NSString.html#//appleref/occ/instm/NSString/stringByReplacingOccurrencesOfString:withString:] to insert '
    ' in place of each occurance of the char identified in step 1. E.g., if the char turns out to be a single carriage return:
    myLabel.text = [stringFromParser stringByReplacingOccurrencesOfString:@"
    " withString:@"
    Some ways to do step 1:
    Examine the raw xml;
    Loop through a string (e.g. label.text) and print the numeric code point of each char with NSLog();
    Format the output of gdb to print the code points (e.g. as hex). Here's a quick tutorial: [GDB Output Formats|http://www.delorie.com/gnu/docs/gdb/gdb_55.html].
    Let us know if you need help interpreting the text obtained by any of these methods. For example, if the hex output from gdb doesn't make sense, just paste directly from your Console window into the forum so we can have a look at it.
    - Ray

  • How to add Line hight in sap.ui.layout.form.Form ?

    Hi,
    i am using the sap.ui.layout.form.Form and sap.ui.layout.form.ResponsiveLayout as layout. And i gave line height from CSS using 'line-height' style, it is working good in Chrome but coming to the IE, the text  in all buttons are looking like below .
    If we increase the height it is showing the text, but i don't want to increase the button height.
    Is there any way i can do this using any layout styles, i am m=not able to find any 'line-height' kind of properties in the Form of ResponsiveLayout .
    Thank you,

    Hi Shashank,
         Add this class in CSS and change the values as required.
    .sapUiBtnS { 
    padding: 4px 58px 19px;
    height: 22px;
    font-size: 12px;

  • How to add lines level detail.

    So far I did not include the line level details into the system. Now we have decided to add the line level data. I am thinking to create another object with line no. Am I going in Right Direction?
    Thanks, VP.

    Hello,
    I think you need to provide more information in your post. 
    What DataSource(s) are you using?
    What type of infoProvider are you using?
    etc...
    Thanks,
    Nick

  • How to add lines to scatter/bubble chart?

    Hi,
    I have bubble and scatter charts for which I'd like to add some horizontal lines, such as sales goals. Anyone?
    Appreciate any suggestions/ideas.

    FileWriter(String fileName, boolean append) throws IOException
    If append is true, then output is appended to the end of the file. Here is an example:
    import java.io.*;
    public class  AATest1
         public static void main(String args[])
              try
                   //Open file for writing:
                   File data = new File("C:\\TestData\\javaIO.txt");
                   BufferedWriter out = new BufferedWriter(
                                  new FileWriter(data) );
                   out.write("hello");
                   out.close(); //flushes buffer
                   //Open file for appending:
                   out = new BufferedWriter(
                        new FileWriter(data, true) );
                   out.write(" world");
                   out.close(); //flushes buffer
              catch(IOException exc)
                   System.out.println("io error writing to file");
    }

  • How To Add Line Items to Workflow Document Template

    Hi Gurus,
    ive made a Workflow which has few containers referencing VBKPF, VBSEGS, and constructed two methods which one of them gets the table VBKPF data into MyStructure and the second the data into MyStructure2.
    Inside of the workflow i made two container operations and assigned those two methods to VBKPF and VBSEGS containers.
    The Problem is that VBSEGS is a (multi) line item table and it doesnt show me the data inside of the document template.
    What could be the solution for this scenario
    Thanks, Points for Reward

    Hi,
    i checked the swo1 methods and it looks good. I didnt change the binding that ive implemented, and some values are getting showed, but still they do not correspond to the BO element (concerning Acct.Doc.Nr)
    My binding is:
    Display Document Task:
    #######Workflow -> Step Display Parked Doc
    **************BO FIPP -> &_WI_OBJECT_ID&
    #######Workflow <- Step Display Parked Doc
    **************Empty
    Document Template:
    #######Workflow -> Step Create Doc From Template
    **************&_WORKITEM& -> &FLOWITEM&
    **************DC8BA2ADFCEA4EF18D2F00145EDCE7A4 -> &TEMPLATE&
    #######Workflow <- Step Create Doc From Template
    **************&WF_DOCUMENT_0001& <- &_WI_OBJECT_ID&
    **************&_WF_INITIATOR& <- &_WI_ACTUAL_AGENT&
    As ive explained earlier i have a Container VBSEGS with abap table vbsegs, which is filled using method ReturnMe2 with MyStruct2 structure.
    Regards
    Laurynas Prikockis

  • How to add line items to Accounting Document posted through MIRO ?

    I need to perform Additional posting when Posting through MIRO transaction..i tried with INVOICE_UPDATE BADI but this was not useful...Please let me know if there is any way to add additional posting to Accounting Document created through MIRO.
    If any user exit , BADI ot BTE present?

    Hi,
    Check the BTE's:
    00001020     POST DOCUMENT:       Prior to final checks             SAMPLE_INTERFACE_00001020
    00001025     POST DOCUMENT:       Final checks completed       SAMPLE_INTERFACE_00001025
    00001030     POST DOCUMENT:       Posting of standard data     SAMPLE_INTERFACE_00001030
    00001050     POST DOCUMENT:       Accounting interface           SAMPLE_INTERFACE_00001050
    Thanks & Regards,
    Harish

  • How to add Line Chart in javafx 2.2 FXML?

    I'm using javaFX scene builder 1.0. The LineChart component is not working for FXML ,I'm added a linechart component in FXML and initialized it in corresponding controller class. it displays the gui as default linechart ,when i'm adding some values of x and y using obsevablelist in the java controller class, it is not updating in the Linechart gui.

    It's hard to say for sure without seeing the complete markup and controller code, but it looks like you are replacing the "graph" instance you declare in markup with a new one you create in code:
    graph = new LineChart(xAxis, yAxis, lineChartData);Rather than creating a new chart, try declaring the chart with the axes you want in markup, and then call setData() on it instead of creating a new one:
    <Scene fx:controller="test.LineChartTestController" xmlns:fx="http://javafx.com/fxml">
        <LineChart fx:id="graph">
            <xAxis><NumberAxis label="Values for X-Axis" lowerBound="0" upperBound="3" tickUnit="1"/></xAxis>
            <yAxis><NumberAxis label="Values for Y-Axis" lowerBound="0" upperBound="3" tickUnit="1"/></yAxis>
        </LineChart>
    </Scene>
    public class LineChartTestController {
        @FXML private LineChart<Double, Double> graph;
        @FXML
        protected void initialize() {
            ObservableList<XYChart.Series<Double, Double>> lineChartData = FXCollections.observableArrayList();
            LineChart.Series<Double, Double> series1 = new LineChart.Series<Double, Double>();
            series1.setName("Series 1");
            series1.getData().add(new XYChart.Data<Double, Double>(0.0, 1.0));
            series1.getData().add(new XYChart.Data<Double, Double>(1.2, 1.4));
            series1.getData().add(new XYChart.Data<Double, Double>(2.2, 1.9));
            series1.getData().add(new XYChart.Data<Double, Double>(2.7, 2.3));
            series1.getData().add(new XYChart.Data<Double, Double>(2.9, 0.5));
            lineChartData.add(series1);
            LineChart.Series<Double, Double> series2 = new LineChart.Series<Double, Double>();
            series2.setName("Series 2");
            series2.getData().add(new XYChart.Data<Double, Double>(0.0, 1.6));
            series2.getData().add(new XYChart.Data<Double, Double>(0.8, 0.4));
            series2.getData().add(new XYChart.Data<Double, Double>(1.4, 2.9));
            series2.getData().add(new XYChart.Data<Double, Double>(2.1, 1.3));
            series2.getData().add(new XYChart.Data<Double, Double>(2.6, 0.9));
            lineChartData.add(series2);
            graph.setData(lineChartData);
            graph.createSymbolsProperty();
    }

Maybe you are looking for

  • Setting default text to dropdown listbox

    I have a field on my Webdynpro defined as DropDownByKey. The field's list for the dropdown list is coming from a domain with a list of all the values. I want to default the field to one of the values in the list from the domain, but I want the descri

  • Incoming payment problem

    Hi expert, Now i have issue in my project about incoming payment. In detail: When you sell good to distributor and issue invoice. After that you get money from distributor. But they never pay you base on invoice and full invoice. In SAP we have 2 way

  • Re: JEditorPane WIth HTML Table

    hello, use editorPane.dump(System.out); to know if tables are in your document. If yes, there is a graphical problem (in view classes) What is exactly the problem (exception, not drawn, drawing but not what you want...) ?

  • January Update not working with 1.1.4 or latest iTunes

    Hi, I just updated to 1.1.4 firmware but I did not purchase the january update. When I click to purchase it, nothing happens. Since I have no purchase on this item, is there another way to order the purchasew or download. What a waste of time and I a

  • Wlc 2100 error

    Just purchased and installed a Cisco WLC 2100. I am  getting the following message on the controller:Decrypt errors occurred for client 00:18:de:82:eb:57 using WPA2 key on 802.11b/g The client is connecting but I am not getting a dhcp address.