How to make lines in GridLayout?

I use GridLayout with 2 columns and many rows. I want to draw a line between the two columns. How can I do this in GridLayout?

tjacobs01 wrote:
overridding paintComponent probably won't work, because the children will paint over it. Not if the opaque has been set. Also, I wonder if the "gaps" will show through even if the children keep opaque true.
Yep, you can do this by setting the background color of the panel to the column line color you desired, and let this color "shine through" the gaps in the grid layout:
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JComponent;
import javax.swing.SwingConstants;
public class GridsShowQuestion
  private static final int GAP = 10;
  private static final int ROWS = 3;
  private static final int COLS = ROWS;
  private static final int FONT_SIZE = 50;
  private JPanel mainPanel = new JPanel();
  public GridsShowQuestion()
    mainPanel.setBackground(Color.red);
    mainPanel.setLayout(new GridLayout(ROWS, COLS, GAP, 0));
    for (int i = 0; i < ROWS; i++)
      for (int j = 0; j < COLS; j++)
        JLabel lbl = new JLabel("X");
        lbl.setFont(new Font(Font.DIALOG, Font.BOLD, FONT_SIZE));
        int eb = 10;
        lbl.setBorder(BorderFactory.createEmptyBorder(eb, 3*eb, eb, 3*eb));
        lbl.setHorizontalAlignment(SwingConstants.CENTER);
        lbl.setOpaque(true);
        mainPanel.add(lbl);
  public JComponent getComponent()
    return mainPanel;
  private static void createAndShowUI()
    JFrame frame = new JFrame("GridsShowQuestion");
    frame.getContentPane().add(new GridsShowQuestion().getComponent());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  public static void main(String[] args)
    java.awt.EventQueue.invokeLater(new Runnable()
      public void run()
        createAndShowUI();
}Edited by: Encephalopathic on Oct 14, 2008 7:16 PM

Similar Messages

  • How to make lines I draw as an objects??

    Hi friends:
    I met a problem here, I find a similiar code below, but cannot solve it.
    How to make lines I draw as objects in this application??
    ie the lines I draw will be selectable as other JLabels, can be highlighted, can be deleted etc, just like any other components or object,
    How to do this??
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.util.Vector;
    import java.lang.reflect.Array;
    import javax.swing.*;
    import javax.swing.event.*;
    public class Drawines
         public static void main(String[] args)
            JFrame f = new JFrame("Draw Lines");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(new ConnectionPanel());
            f.setSize(400,300);
            f.setLocation(200,200);
            f.setVisible(true);
    class Drawines extends JPanel
        JLabel                                       label1, label2, label3, label4;
        JLabel[]                       labels;
        JLabel                                       selectedLabel;
        protected              JButton btn            = new JButton("DrawLines");
        protected              JButton btn1           = new JButton("Clear");
        protected              JButton btn2           = new JButton("No Draw");
        protected                      boolean isActivated = false;
        protected           int      stoppoint     = 0;          
        int cx, cy;
        Vector order                     = new Vector();
        Vector order1                     = new Vector();
        Object[] arr                    = null;
        public ConnectionPanel()
            setLayout(null);
            addLabels();
            label1.setBounds( 25,  50, 125, 25);
            label2.setBounds(225,  50, 125, 25);
            label3.setBounds( 25, 175, 125, 25);
            label4.setBounds(225, 175, 125, 25);
            btn.setBounds(10, 5, 100, 25);
            btn1.setBounds(100, 5, 100, 25);
            btn2.setBounds(200, 5, 100, 25);
                add(btn);
             add(btn1);
             add(btn2);
            determineCenterOfComponents();
            ComponentMover mover = new ComponentMover();
             ActionListener lst = new ActionListener() {
                 public void actionPerformed(ActionEvent e) {
                     ComponentMover mover = new ComponentMover();
                           addMouseListener(mover);
                           addMouseMotionListener(mover);
                           isActivated = false;
            ActionListener lst1 = new ActionListener() {
                       public void actionPerformed(ActionEvent e) {
                           isActivated=true;
              btn.addActionListener(lst);
              btn1.addActionListener(lst1);
        public void paintComponent(final Graphics g)
             super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
             Point[] p;
                System.out.println("order.size()"+ order.size());
                System.out.println("order1.size()"+ order1.size());
                     if (!isActivated && order1.size()==0) {
                         for(int i = 0 ; i < order.size()-1; i++) {
                                JLabel l1 = (JLabel)order.elementAt(i);
                               JLabel l2 = (JLabel)order.elementAt(i+1);
                               order1.add(order.elementAt(i));
                               order1.add(order.elementAt(i+1));
                               System.out.println();
                               p = getCenterPoints(l1, l2);
                               g2.setColor(Color.black);
                                            g2.draw(new Line2D.Double(p[0], p[1]));            
                     }else if(!isActivated && order1.size()>0){
                             order=order1;
                         for(int i1 = 0 ; i1 < order.size()-1; i1++) {
                               JLabel l1 = (JLabel)order.elementAt(i1);
                               JLabel l2 = (JLabel)order.elementAt(i1+1);
                               System.out.println();
                               p = getCenterPoints(l1, l2);
                               g2.setColor(Color.red);
                                g2.draw(new Line2D.Double(p[0], p[1]));    
                                System.out.println(" order1.size() = " + order.size());
                     }else {
                          order1 = order;
                         for(int i1 = 0 ; i1 < order1.size()-1; i1++) {
                                    JLabel l1 = (JLabel)order1.elementAt(i1);
                                    JLabel l2 = (JLabel)order1.elementAt(i1+1);
                                    p = getCenterPoints(l1, l2);
                                    g2.setColor(Color.blue);
                                    if (order.elementAt(i1) !=null){
                                         g2.draw(new Line2D.Double(p[0], p[1]));    
        private Point[] getCenterPoints(Component c1, Component c2)
            Point
                p1 = new Point(),
                p2 = new Point();
            Rectangle
                r1 = c1.getBounds(),
                r2 = c2.getBounds();
                 p1.x = r1.x + r1.width/2;
                 p1.y = r1.y + r1.height/2;
                 p2.x = r2.x + r2.width/2;
                 p2.y = r2.y + r2.height/2;
            return new Point[] {p1, p2};
        private void determineCenterOfComponents()
            int
                xMin = Integer.MAX_VALUE,
                yMin = Integer.MAX_VALUE,
                xMax = 0,
                yMax = 0;
            for(int i = 0; i < labels.length; i++)
                Rectangle r = labels.getBounds();
    if(r.x < xMin)
    xMin = r.x;
    if(r.y < yMin)
    yMin = r.y;
    if(r.x + r.width > xMax)
    xMax = r.x + r.width;
    if(r.y + r.height > yMax)
    yMax = r.y + r.height;
    cx = xMin + (xMax - xMin)/2;
    cy = yMin + (yMax - yMin)/2;
    private class ComponentMover extends MouseInputAdapter
    Point offsetP = new Point();
    boolean dragging;
    public void mousePressed(MouseEvent e)
    Point p = e.getPoint();
    for(int i = 0; i < labels.length; i++)
    Rectangle r = labels[i].getBounds();
    if(r.contains(p) && !isActivated )
    selectedLabel = labels[i];
    order.addElement(labels[i]);
    offsetP.x = p.x - r.x;
    offsetP.y = p.y - r.y;
    dragging = true;
    repaint(); //added
    break;
    public void mouseReleased(MouseEvent e)
    dragging = false;
    public void mouseDragged(MouseEvent e)
    if(dragging)
    Rectangle r = selectedLabel.getBounds();
    r.x = e.getX() - offsetP.x;
    r.y = e.getY() - offsetP.y;
    selectedLabel.setBounds(r.x, r.y, r.width, r.height);
    //determineCenterOfComponents();
    repaint();
    private void addLabels()
    label1 = new JLabel("Label 1");
    label2 = new JLabel("Label 2");
    label3 = new JLabel("Label 3");
    label4 = new JLabel("Label 4");
    labels = new JLabel[] {
    label1, label2, label3, label4
    for(int i = 0; i < labels.length; i++)
    labels[i].setHorizontalAlignment(SwingConstants.CENTER);
    labels[i].setBorder(BorderFactory.createEtchedBorder());
    add(labels[i]);
    Thanks in advance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    2 choice, bundle your app in a jar, or get a native compiler.
    executable jar
    http://java.sun.com/j2se/1.3/docs/guide/jar/jarGuide.html
    http://developer.java.sun.com/developer/qow/archive/21/index.html
    native
    http://gcc.gnu.org/java/
    http://www-106.ibm.com/developerworks/library/j-native.html
    http://icafe.sourceforge.net/
    http://www.towerj.com/
    http://www.xlsoft.com/en/products/development/jet/jetpro.html

  • How to make lines for "fill in the blanks?" (iWork Pages 09)

    This should be easy since it's something many people do: design a form for others to fill out with a pen or pencil.  However, I can't find any information regarding how to make a line after text, like this:
    Name _________________ Address _________________________________ Phone __________
    ...without using the underline character.
    Back on the Clarisworks days there was some way to make nice neat lines after text using tabs.  However, It's been so long that I can't recall how it worked.  I've Googled this issue using every logical term I can think of but found nothing useful.  The Pages 09 help file and the user guide  seem to be mute on this subject. The Word 2008 help file is similarly silent.  However, I'm sure that the greater Pages community knows the answer to this one.
    Thanks,
    Bill

    What you want is called a tab leader. In Pages, to create the underline:
    To create a new tab stop using the Text inspector, click in the document where you want to create a new tab stop, click Inspector in the toolbar, and then click Tabs. Click the Add button in the bottom-left corner of the Tabs pane. The new tab stop appears in the Tab Stops column.
    Then  use the Leader drop down menu to choose a solid line:

  • How to make line-in come out rear speakers? (SB Live! 5

    Card is SB Li've! 5. DE and OS is XP SP2:
    ================================
    I have tried everything that I can think of. It was working fine until I installed a program which screwed up my mixer settings. I have loaded the default mixer settings. Now my rear speakers only work for wave devices, but not line-in.
    Is there a way to make line-in come out both the front and rear speakers, or set the rear speakers to duplicate the front speakers (losing the surround feature)?
    Failing that I will have to resort to plugging both sets of speakers into the one socket via an adapter - I don't wish to do this as I had this working for many months.
    Please help.
    grol
    Message Edited by groslchie on <SPAN class=date_text>-2-2005 <SPAN class=time_text>07:22 AM
    Message Edited by groslchie on -2-2005 07:23 AM

    Weird. I just installed Creative PlayCenter from the driver CD and after the reboot, line-in now comes out the rear speakers again. Must've been some system files updated or something, because CMSS is still off according to PlayCenter. When I turn CMSS on, the line-in stops coming out rear, but turning it off makes it work!!!! So it's sorted, but still have no idea why it screwed up and why I needed PlayCenter installed to change the CMSS settings.

  • How to make lines for writing?

    How do I create lines for writing?

    tablet = note book
    Make the paragraph style as mentioned above. Adjust the space after as desired, the line weight for the rule below. Press enter for each paragraph.
    Mike

  • How to make line thicker?

    When I use "g.drawLine()" to draw a line,the size of the line is fixed.But I would like to make the line thicker.How to do that?Thanks!

    one of my favorite methods :)
        void drawThickLine(Graphics2D g, double x1, double y1, double x2, double y2, double width) {
            Stroke orig = g.getStroke();
            BasicStroke wideStroke = new BasicStroke((float)width);
            g.setStroke(wideStroke);
            g.draw(new java.awt.geom.Line2D.Double(x1,y1,x2,y2));
            g.setStroke(orig);
        }Enjoy!

  • How to make line chart start at y-axis?

    How do you make the series on a line chart start at the y-axis?  I tried adding a data point for y(x=0), but the Xcelsius graph drops it and starts with y(x=1).  How do I fix that?  This is especially important for series that need to start at zero.

    Post Author: amr_foci
    CA Forum: Xcelsius and Live Office
    its all based on ur design of your Excel sheet
    design how it will be in Excel first
    then go to xeclsius
    ,,, by the way it looks very easy task
    you can do it.

  • How to make line segments persist

    I am studying by myself, and I have already Googled the subject line, to no avail.
    I am trying to write lines with movement dictated by the arrow keys. I can get a line segment to move, but after the movement the whole panel gets repainted. So I don't get any lines written anywhere.
    Anyone have a solution to this?
    Here's my code.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class DrawLinesUsingKeys extends JFrame {
        private DisplayCoordinatePanelSEVEN keyboardPanel =
                new DisplayCoordinatePanelSEVEN();
        public DrawLinesUsingKeys() {
            getContentPane().add(keyboardPanel);
            keyboardPanel.setFocusable(true);
        /**Main method*/
        public static void main(String[] args) {
            // Create a frame
            DrawLinesUsingKeys frame = new DrawLinesUsingKeys();
            frame.setTitle("Draw Lines Using Keys");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(300, 300);
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
    class DisplayCoordinatePanelSEVEN extends JPanel implements KeyListener {
        private boolean pressedAction = false;
        private int x = 150;
        private int y = 150;
        private int z = 150;
        private int a = 150;
        public DisplayCoordinatePanelSEVEN() {
            addKeyListener(this);
        public void keyPressed(KeyEvent e) {
            pressedAction = true;
            switch (e.getKeyCode()) {
                case KeyEvent.VK_DOWN:
                    a = y + 10;
                    break;
                case KeyEvent.VK_UP:
                    a = y - 10;
                    break;
                case KeyEvent.VK_LEFT:
                    z = x - 10;
                    break;
                case KeyEvent.VK_RIGHT:
                    z = x + 10;
            repaint();
        public void keyReleased(KeyEvent e) {
        public void keyTyped(KeyEvent e) {
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            g.setColor(Color.BLACK);
            if (pressedAction) {
                g.drawLine(x, y, z, a);
                pressedAction = false;
                x = z;
                y = a;
        }Thank you for your time.

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class DrawLinesUsingKeys extends JFrame {
        private DisplayCoordinatePanelSEVEN keyboardPanel =
                new DisplayCoordinatePanelSEVEN();
        public DrawLinesUsingKeys() {
            getContentPane().add(keyboardPanel);
            keyboardPanel.setFocusable(true);
        public static void main(String[] args) {
            DrawLinesUsingKeys frame = new DrawLinesUsingKeys();
            frame.setTitle("Draw Lines Using Keys");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(300, 300);
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
    class DisplayCoordinatePanelSEVEN extends JPanel implements KeyListener {
        java.util.List<Point> points = new java.util.ArrayList<Point>();
        private boolean pressedAction = false;
        private int x = 150;
        private int y = 150;
        private int z = 150;
        private int a = 150;
        public DisplayCoordinatePanelSEVEN() {
            addKeyListener(this);
            points.add(new Point(x,y));
        public void keyPressed(KeyEvent e) {
            pressedAction = true;
            switch (e.getKeyCode()) {
                case KeyEvent.VK_DOWN:
                    //a = y + 10;
                    y += 10;
                    points.add(new Point(x,y));
                    break;
                case KeyEvent.VK_UP:
                    //a = y - 10;
                    y -= 10;
                    points.add(new Point(x,y));
                    break;
                case KeyEvent.VK_LEFT:
                    //z = x - 10;
                    x -= 10;
                    points.add(new Point(x,y));
                    break;
                case KeyEvent.VK_RIGHT:
                    //z = x + 10;
                    x += 10;
                    points.add(new Point(x,y));
            repaint();
        public void keyReleased(KeyEvent e) {
        public void keyTyped(KeyEvent e) {
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            g.setColor(Color.BLACK);
            if (pressedAction) {
                for(int xx = 0, yy = points.size()-1; xx < yy; xx++)
                  Point p1 = points.get(xx);
                  Point p2 = points.get(xx+1);
                  g.drawLine(p1.x, p1.y, p2.x, p2.y);
                pressedAction = false;
                //x = z;
                //y = a;
    }

  • NEED HELP!!!How to make LINES Colorful--PLEASE HELP!!!!!!

    i want to draw a red line:
    Graphics g;
    g = b.getGraphics();
    g.drawLine(20,5,100,64);
    but the line is black, i want it red.
    the command g.setColor(color.RED) is not working....
    WHATS WRONG, please help, thanks thomas

    Here is my code....
    mport com.ms.wfc.app.*;
    import com.ms.wfc.core.*;
    import com.ms.wfc.ui.*;
    import com.ms.wfc.html.*;
    import com.ms.awt.*;
    * Diese Klasse kann eine variable Anzahl von Parameter auf der Befehlszeile
    * entgegennehmen. Die Programmausf�hrung startet mit der Methode main(). Der
    * Klassenkonstruktor wird nicht aufgerufen, bevor nicht ein Objekt vom Typ 'exel'
    * in der Methode main() erstellt wird.
    public class exel extends Form
         String datum2="";
         String userdateinput="";
         int count=0;
         int i=0;
         int day7=0;
         int m=0;
         int p=0;
         public exel()
              super();
              for (i=0;i<31;i++)
              Point[count]="305";
         Graphics g;
         int xx1=5;
         int xy1=305;
         int xx2=600;
         int xy2=305;
         int yx1=5;
         int yy1=5;
         int yx2=5;
         int yy2=305;
         int i=0;
         //Bitmap b = new Bitmap("c:\\BACKGROUND.BMP");
         Bitmap b = new Bitmap(600,600);
         b.setTransparentColor(Color.RED);
         g = b.getGraphics();
         g.drawRect(0,0,600,600);
         g.drawRect(0,0,600,600);
         g.setBackColor(Color.RED);
    g.setColor(Color.RED);//HERE IS THE ERROR!!!
         g.drawLine(5,10,5,305);
         g.drawLine(5,10,10,10);
         g.drawLine(xx1,xy1,xx2,xy2);
         for (i=0;i<5;i++)
              yx1=5;
              yy1=60+yy1;
              yx2=10;
              yy2=yy1;
              g.drawLine(yx1,yy1,yx2,yy2);
         for (i=0;i<31;i++)
              xx1=xx1+15;
              xy1=305;
              xx2=xx1;
              xy2=300;
              g.drawLine(xx1,xy1,xx2,xy2);
         int h=0;
         int counter7=0;
         yx1=-10;
         int counter8=0;
         int counter6=0;
         for (h=1;h<31;h++)
              int cpoint=com.ms.wfc.util.Value.toInt(Point[h-1]);
              int cpoint2=com.ms.wfc.util.Value.toInt(Point[h]);
              yy1=305-(cpoint*3);
              yy2 = 305-(cpoint2*3);
              yx1=yx1+15;
              yx2 = yx1+15;
              if (cpoint==0)
                   yy1 = 0;
                   yy2 = 0;
                   yx1 = 0;
                   yx2 = 0;
              if (cpoint2==0)
                   yy1 = 0;
                   yy2 = 0;
                   yx1 = 0;
                   yx2 = 0;
              g.drawLine(yx1,yy1,yx2,yy2);
              if (cpoint==0)
                   for (counter6=0;counter6<counter7;counter6++)
                        yx1=yx1+15;
                        yx2 = yx1+15;
              if (cpoint2==0)
                   for (counter8=0;counter8<counter7;counter8++)
                        yx1=yx1+15;
                        yx2 = yx1+15;
              counter7++;
         pictureBox1.setImage(b);
              // Erforderlich f�r die Unterst�tzung des Visual J++-Formulardesigners
              initForm();          
              // ZU ERLEDIGEN: F�gen Sie beliebigen Konstruktorcode hinter den Aufruf von initForm hinzu
         * exel �berl�dt dispose, damit es die Komponentenliste
         * bereinigen kann.
    public void dispose()
         super.dispose();
         components.dispose();
    String DATUM="";
    private void start_click(Object source, Event e)
         /**DATE**/
         java.util.Date Date = new java.util.Date();
         java.sql.Date sqldate = new java.sql.Date(Date.getTime());
         String dat = String.valueOf(sqldate);
         //datum.setText(DATUM);
         //Start von EXEL
         try
              String makro="C:\\Program Files\\Microsoft Office\\Office\\XLSTART\\PERSONL.xls";
              String cmd = "C:\\Temp\\"+DATUM+"FLIP.xls";
              //String cmd = "C:\\Program Files\\Microsoft Office\\Office\\EXCEL.EXE Gr8galry.gra";
              String line = null;
              Process p1 = Runtime.getRuntime().exec(cmd);
              Process p2 = Runtime.getRuntime().exec(makro);
              //p.destroy();
         catch (java.io.IOException e1)
              //exception.setText("error");
    String Point[]=new String[31];
    private void button1_click(Object source, Event e)
         close();
    }

  • How to make the values of a combination graph (bar and line) visible always

    Hi ,
    I am using jdev 11.1.1.6
    i have created a combination graph which has a bar and line.
    The data with respect to bar and graph were only visible when i keep the mouse pointer on it.
    i need to set the values visible always.
    kindly let me know how to make it.
    In pie graph its by default showing the data always.
    regards
    Siva

    Hi Sameh Nassar,
    Thanks for the input, am using the combination graph and i dont have this property added till now.
    i tried adding them manually in source but it didn't work. so I assume that this property is good with pie chart alone.
    please correct me if am wrong.
    This is my combination graph structure.
        <dvt:comboGraph id="comboGraph1"
                          value="#{bindings.testVO1.graphModel}"
                          subType="COMBINATION_VERT_ABS_2Y" shortDesc="Graph 1">
            <dvt:background>
              <dvt:specialEffects/>
            </dvt:background>
            <dvt:graphPlotArea/>
            <dvt:seriesSet markerDisplayed="true">
              <dvt:series lineWidth="0"/>
            </dvt:seriesSet>
            <dvt:o1Axis/>
            <dvt:y1Axis/>
            <dvt:y2Axis/>
            <dvt:legendArea automaticPlacement="AP_NEVER"/>
            <dvt:graphTitle text="Combination graph"/>
            <dvt:o1Title text="x axis"/>
            <dvt:y1Title text="y1 axis"/>
             <dvt:y2Title text="y2 axis"/>
          </dvt:comboGraph>
    regards
    Siva

  • How to make new line in JButton.setText()?

    how to make new line in JButton.setText()?
    I want to set the text of jbutton in tow line ,as follows
    | jbutton-line1 |
    | xxxxxxx-line2 |
    i konw i can jbtton.settext("<html>line1<br>line2</html>");
    but i find it's ugly using html,
    is there anyother way to create new line in JButton's Text

    As for the above comment....
    I thought the question was well purposed. Using HTML was not acceptable in this instance, which was made clear, so why critisize his comments? "Using HTML" is a poor solution, it does NOT work in many instances due to browser, OS variations. Usually the "common answer" is never a COMPLETE answer.
    Possible Solution:
    Use JLabels to render the text on the button.
    import javax.swing.*;
    import java.awt.*;
    public class ButtonMaker {
    public static void makeButton(JButton jb, String[] titleList) {
    jb.setLayout(new FlowLayout());
    for (int i = 0; i < titleList.length; i++) {
    JLabel tmpLabel = new JLabel(titleList);
    tmpLabel.setForeground(Color.black);
    jb.add(tmpLabel);
    public static void clearButton(JButton jb) {
    Component[] cList = jb.getComponents();
    for (int i = 0; i < cList.length; i++) {
    if (cList[i] instanceof JLabel)
    jb.remove(cList[i]);
    Known Limitations:
    1. Flowlayout does not work well with single line text buttons... perhaps another layout manager may work better for various buttonsizes-linenumber combos.
    2. Mac OSX : The default UI for Mac OS X (and above it seems), is to have rounded edged buttons. These rounded edges are destoryed when using JLabels, leaving a square, blocky button in its place.
    POSSIBLE SOLUTION:
    (this is ugly and time consuming)
    - create images of the button with text on them.

  • How to make plant in shipping cond tab for line item in sales doc mandatory

    Hi
    How to make plant as mandatory for a sales document say quotation mandatory ? I went to SPRO-> Basic Fucntion - > log of incomplete terms ->  Define incomplete Groups -> B.selected sales -Item -> Created new procedure Z001 with fielda VBAP - WERKS ,selected screen name PDE2 and checked warning check box.
    When i goto Assign incompleteness procedures I donot have option to assign it sales document item level procedure i will only get sales doc header procedure to assign it to document type quotation.
    How to make plant as mandatory for each line item in quotation?
    Thanks,
    Vaishnavi

    Include: MV45AFZB
    Form  USEREXIT_CHECK_VBAP
    In our business scenario, we have used the same ,But  Plant is mandatory only for 1st line item-
    source code:
    IF vbak-vkorg = '1000' OR vbak-vkorg = '2000'.
        IF sy-tcode = 'VA31' OR
           sy-tcode = 'VA11' OR
           sy-tcode = 'VA21' OR
           sy-tcode = 'VA41' OR
           sy-tcode = 'VA01' .
          IF vbap-werks IS INITIAL AND
             vbap-posnr EQ '000010'.
            MESSAGE e398(00) WITH 'Please enter the plant for first line'.
          ENDIF.
        ENDIF.
      ENDIF.
    Help:
    Through this form exit we are making the "plant' field (for the ist  &*
    & line item ) mandatory for the sales document . This interns helps us &
    & to create the sales document numner according to the plant (Region)  &
    *& of the Plant
    Hope it clears. take assistance of your ABAPer.

  • How to make the vendor column have figure in GRIR line item with RE document type?

    Dear Experts,
         Could you tell me how to make the vendor column have figure in GRIR line item whose document type is RE?
         Thanks!
    Xinling Zhang

    Hi ,
    You are using FAGLL03 .
    FAGLL03 report vendor code is blank
    vendor number in new FAGLL03 tcode (offsetting account information)
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/30b96fed-eb5d-2e10-1792-f3ff9f65df8a?QuickLink=index&…
    Also check OSS note
    Note 112312 - Line item: Display of offsetting a/c information
    Note 1034354 - FAGLL03: Display of offsetting account information
    Many Thanks

  • How to make the GL account discription possible in FAGLL03 line item display?

    Dear Experts,
        Could you tell me how to make the GL account discription possible in FAGLL03 line item display?
        I checked the layout, there is no account discription.
        How should I do?
    Thanks!
    Xinling Zhang

    Hi
    One you execute FAGLL03, go to Settings>Layout>Current Header Rows
    You can add some predefine characteristics here.
    I am not sure why the hyperlink is not working at your end. But you can search the SDN for special fields in FAGLL03 and you can get lot of posts for this document.
    Regards
    Sanil Bhandari

  • How to make a Input Field with multiple lines?

    hey folks,
    i need to make a popup window or a dynpro with 2 input fields, where the user can write on multiple lines. why isnt there such an input field in the screen painter? how can i make this? if i can do this with a dynpro it would be nice but a popup with that feature would be better. didnt found any infos anywhere except for that thread, but its answer didnt work with my dynpro:
    How to make a input/output field with multiple lines
    thx for any helping answer

    i made it just like in that thread but there is an error message telling that gv_custom_container is not declared.
    *  MODULE status_0110 OUTPUT
    MODULE status_0110 OUTPUT.
      CREATE OBJECT custom_container
        EXPORTING
          container_name              = 'TEXT_CONTROL'
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          lifetime_dynpro_dynpro_link = 5.
      CREATE OBJECT text_editor
        EXPORTING
          parent                     = gv_custom_container
          wordwrap_mode              = cl_gui_textedit=>wordwrap_at_windowborder
          wordwrap_to_linebreak_mode = cl_gui_textedit=>false
        EXCEPTIONS
          error_cntl_create          = 1
          error_cntl_init            = 2
          error_cntl_link            = 3
          error_dp_create            = 4
          gui_type_not_supported     = 5.
      SET PF-STATUS 'STATUS_0110'.
      SET TITLEBAR 'TITLE'.
    ENDMODULE.                    "status_0110 OUTPUT
    Edited by: rafe b. on Oct 26, 2009 2:56 PM

Maybe you are looking for