Multiple components in singlecell

i have a table with multple components in a single cell . i want to enable some of those components and rest of them should be disabled.
tried with taking a double dimensional boolean array for state maintainence at model level with this i could make complete cell enable or disable(using isCellEditable() method). but my requirement is some of the components in the cell should be enable.

Check out the javax.swing.table package and implement the
TableCellRenderer interface.Y ou can put any component in
a Header by getting the JTableHeader from the JTable
getting the TableColumnModel from the JTableHeader
getting the TableColumn from the TableColumnModel
and setting the TableCellRenderer for the TableColumn
That should put you on the right track!!!
hope this helps

Similar Messages

  • How to remove multiple components border inside a single table column cell

    Hi,
    I'm adding multiple components to a table cell. To provide a good layout I'm using the following component hierarchy in a table column - table-->groupPanel--> gridPanel-->staticText Components 1 ..2 ..3. Now when I do preview in browser or run the app, the table shows up fine, but textComponent s(1,2,3) in the column are each surrounded by a border (which is the width of gridPanel border). Is there a way to get rid of this border?
    This only occurs when you add multiple components in table cell, under gridpanel layout component.
    I've tried searching for a way to remove the grid pane layout component border but couldn't find any info. Used style class border setting to not set but that doesn't help either. I checked forums, tutorial, learning sections etc., but no success. Any help or direction is appreciated..
    Thanks
    -Vinod

    Hi ,
    Can you please post the query ..what u have tried ...
    SQL> select sub from coa1;
    SUB
    XY
    XY
    XY
    XY
    XY
    HXY
    HXY
    HXY
    8 rows selected.
    SQL> select obj from coa1;
    OBJ
    AM
    AM
    AM
    AK
    AK
    AK
    ATK
    ATK
    8 rows selected.
    SQL> SELECT OBJ FROM COA1
    2 UNION ALL
    3 SELECT SUB FROM COA1;
    OBJ
    AM
    AM
    AM
    AK
    AK
    AK
    ATK
    ATK
    XY
    XY
    XY
    OBJ
    XY
    XY
    HXY
    HXY
    HXY
    16 rows selected.
    SQL> insert into coa2 (obj)
    2 (
    3 SELECT OBJ FROM COA1
    4 UNION ALL
    5 SELECT SUB FROM COA1
    6 );
    16 rows created.
    SQL> select * from coa2;
    OBJ SUB MCU DOC F
    AM
    AM
    AM
    AK
    AK
    AK
    ATK
    ATK
    XY
    XY
    XY
    OBJ SUB MCU DOC F
    XY
    XY
    HXY
    HXY
    HXY
    16 rows selected.
    SQL>
    i tried the same it worked fine .....
    so u can combine select and insert statements .. you can get the required result.....!
    Thanks
    Ananda
    Edited by: Ananda on Feb 2, 2009 7:38 PM
    Edited by: Ananda on Feb 2, 2009 7:52 PM

  • Use of multiple components in ABAP WEB DYNPRO

    Hi,
    Am  new to  abap web dynpro and I just want to know whether  we  can  use  multiple components for an application in web dynpro.
    Thanks ,
    Dhaya.G
    Edited by: Dhayalinie Ganesh on Feb 22, 2012 12:06 PM

    Hi,
    depending requirement of application we can use multiple components.
    for example if we want to display table data into alv grid for that we can use the existing(standard component) ie: SALV_WD_TABLE  .Like such a way we can use the components as per our requirements.
    For importing components:
    --> Go to properties tab of view of your web dynpro application
    --> There you can find one button create controller usage ,click on it then import the components
    Thanks&Regards
    Sreenivas Pachva
    Edited by: sreenivas.p on Feb 22, 2012 1:11 PM

  • Drag and Drop of multiple components at once

    Hi everybody,
    I need to select and drag multiple components (Eg. JLabels) at once, it is quite simple to manage just one drag at a time but how can be managed a multiple drag?
    I mean something like Windows files selection mechanism : using Ctrl + Left mouse click to select the components and then start dragging them all to the drop target.
    Beneath the code I'm using for testing , clicking and dragging each JLabel to JTextField just cause the copy of JLabel text to the JTextField contents.
    In the sample a left click on each displayed label sets a border just to identify the selected status of the labels to drag but there's no implementation of the drop mechanism that should copy all the selected JLabels text to the drop target (the JTextField).
    import java.awt.Dimension;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.util.HashMap;
    import javax.swing.BorderFactory;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    import javax.swing.TransferHandler;
    import javax.swing.UIManager;
    import javax.swing.border.Border;
    import javax.swing.border.CompoundBorder;
    import javax.swing.border.EmptyBorder;
    public class SelectableJLabel extends JPanel {
      MouseListener listener = new DragMouseAdapter();
      public Border getBorder(boolean getSelectedBorder) {
        Border outsideBorder = BorderFactory.createEmptyBorder(2,2,2,2);
        Border insideBorder = BorderFactory.createEmptyBorder(2,2,2,2);
        if (getSelectedBorder)
          insideBorder = BorderFactory.createEtchedBorder();
        return BorderFactory.createCompoundBorder(outsideBorder, insideBorder);
      private class DragMouseAdapter extends MouseAdapter {
        public void mousePressed(MouseEvent e) {
          System.out.println("Press!");
          JComponent c = (JComponent) e.getSource();
          JLabel lbl = (JLabel)c;     
          if (lbl.getBorder()==null || ((CompoundBorder)lbl.getBorder()).getInsideBorder() instanceof EmptyBorder) {
            lbl.setBorder(getBorder(true));
            TransferHandler handler = c.getTransferHandler();
            handler.exportAsDrag(c, e, TransferHandler.COPY);    
          } else
            lbl.setBorder(getBorder(false));        
        /* (non-Javadoc)
         * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
        @Override
        public void mouseClicked(MouseEvent e) {
      public JLabel getSelectableLabel() {
        JLabel selectableJLabel = new JLabel("You can't select me");
        selectableJLabel.setBorder(getBorder(false));
        selectableJLabel.setTransferHandler(new TransferHandler("text"));
        selectableJLabel.addMouseListener(listener);
        return selectableJLabel;
      public SelectableJLabel() {
        // a regular JLabel
        add(getSelectableLabel());
        add(getSelectableLabel());
        add(getSelectableLabel());
        // a look-alike JLabel
        JTextField f = new JTextField("You can select me........................");
        f.setDragEnabled(true);
        //f.setEditable(false);
        f.setBorder(null);
        f.setForeground(UIManager.getColor("Label.foreground"));
        f.setFont(UIManager.getFont("Label.font"));
        add(f);
      public Dimension getPreferredSize() {
        return new Dimension(100, 100);
      public static void main(String s[]) {
        JFrame frame = new JFrame("SelectableJLabel");
        SelectableJLabel panel = new SelectableJLabel();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(panel, "Center");
        frame.setSize(panel.getPreferredSize());
        frame.setVisible(true);
    }Tnx in advance for HELP
    Massimo
    Edited by: JKut on May 2, 2010 10:48 AM

    For multiple selections I recommend to use "JList". The "ListTransferHandler" provided in the "DropDemo" sample code supports multiple selections: [http://java.sun.com/docs/books/tutorial/uiswing/dnd/dropmodedemo.html]. To enable MULTIPLE_INTERVAL_SELECTION, simply remove the following statement in the "DropDemo" class:
            list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);

  • Logging same NC code for multiple components

    Hi,
    When logging NC codes in SAP ME 6.0 it is possible to log the same NC Code (defect) against many ref-des for
    multiple components.
    However when logging a secondary code (Action) for the previous primary NC Code all the choosen ref-des and components
    don't get copied..
    Is this how it is supposed to work or is there a setting somewhere so that all ref-des and components gets copied?
    Best Regards,
    Johan Nordebrink

    Hi Johan,
    The matter of your question is related to Ref Des List re-desinged for 6.0.
    Overall situation looks like a design gap because:
    - no explicit statement in the documentation describing the case of copying multiple Ref Des'es;
    - the case of 1-to-1 relation between Component and Ref Des is mentioned in the context of auto-population of these feilds on tabbing out if one of the field is populated;
    - the case of single Ref Des is widely referenced in the context of VTR that is a new feature in 6.0.
    So, if you need this to be reviewed by Product Mgmt (maybe they agreed to identify this as a bug), as usually you should either ask your SAP ME Consulting representative or submit a support ticket (depending on whom you pefer to talk with ).
    Regards,
    Sergiy

  • Data table header facet with multiple components?

    Hi,
    I have a data table to which I wish to add buttons to change the sort order of the items displayed. However when I add the 'buttons' to the 'header' facet I get strange results - some components are shown, some are not, and the order they appear seems almost random.
    Is the header / footer facet designed only for one component - or can I combine them somehow?
    Code snippet is
    <h:dataTable id="table" rowClasses="oddRow,evenRow" width="80%"
    value="#{ControllerBean.orderedResults}" var="meet">
    <h:column>
    <f:facet name="header">
    <h:commandLink action="#{ControllerBean.setOrder}">
    <h:graphicImage value="/img/up.gif" style="border: 0px" />
    <f:param name="order" value="up-title" />
    </h:commandLink>
    <h:outputText value="#{msgs.title}" />
    <h:commandLink action="#{ControllerBean.setOrder}">
    <h:graphicImage value="/img/down.gif" style="border: 0px" />
    <f:param name="order" value="down-title" />
    </h:commandLink>
    </f:facet>
    <h:outputText id="meetTitle"
    value="#{meet.title}" />
    </h:column>
    etc..
    So to be clear - I want a header that contains two graphic buttons separated by the text. When I run this code as is here, I get just the 'down' button, but by changing the order I can sometimes get the down button and the text......
    Cheers
    Reeling

    Yes, you can place it in a panelGrid or panelGroup component.
    The following is an excerpt from a book:
    TIP: To place multiple components in a table header or footer, you must
    group them in an h:panelGroup tag, or place them in a container component
    with h:panelGrid or h:dataTable. If you place multiple components in a facet, only the
    first component will be displayed.
    Thus you could have something like:
                   <f:facet name="header">
                        <h:panelGrid columns="1">
                             <h:outputText value="#{fields.recordings}" style="font-weight: bolder" />
                             <h:panelGroup>
                                  <h:outputText value="#{fields.type}" style="font-weight: bolder"/>
                                  <h:outputText value="#{fields.date}" style="font-weight: bolder"/>
                                  <h:outputText value="#{fields.time}" style="font-weight: bolder"/>
                             </h:panelGroup>
                        </h:panelGrid>
                   </f:facet>

  • JOptionPane: adding multiple Components

    Hello,
    I am trying to add multiple components to a JOption Pane. When the JOptionPane is displayed, the JOptionPane is not resized in order to display all of the components. In my case, the buttons of the JOptioPane are pushed down. Only the upper half of buttons are visible.
    How do you set the JOptionPane to fully display all of the objects that were passed into it?

    What do you mean by saying that the components should be added to the JPanel using the setBounds() method?
    I currently have this:
    JPanel p = new JPanel(null);
    p.add(new JLabel("Label"));
    p.add(new JEditorTextPane("text/plain", "Text"));
    p.add(new JTextField("Text field"));
    p.setBounds(new Rectangle(200, 200));
    JOptionPane.showOptionDialog(null, p, "Title", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE, null, null, null);
    With this code, I do not even see the "OK" button. The dialog is not resizing correctly. Also, the components are getting laid out incorrectly in the JPanel. Everything is laid out from left to right.

  • Multiple Components in a JScrollPane

    Hi all,
    I'm trying to create a JScrollPane with multiple components in it, inside a TabPane. However I keep running into problems getting the display working.
    The contents of the ScrollPane will be determined at runtime and will consist of "n" tables and JLabels, in no particular order. The only constraint is that I want to have the components displayed in rows (one column per row). The number of rows and columns in each of the JTables (and therefore their size) will also be determined at runtime.
    I've run into problems where the JScrollPane only shows the last JTable added. I've tried adding a JPanel to the JScrollPane and then adding the tables to that, but the display doesn't work - maybe something I've missed on the sizing?
    Any clues on where I should focus will be most appreciated.
    Thanks

    Hi,
    Thanks for the suggestion - I've tried using the following test code, but I cannot get it to display anything:
    public class AFrame extends JFrame {
      private JScrollPane jScrollPane1 = new JScrollPane();
      public AFrame() {
        try {
          this.getContentPane().setLayout(new BorderLayout());
          this.setTitle("Test Frame");
          this.setSize(500, 500);
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          this.getContentPane().add(jScrollPane1, null);
          jScrollPane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
          jScrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
          //create a table   
          JTable table1 = new JTable();
          table1.setModel(new TestTableModel());
          TableColumnModel colmod = table1.getColumnModel();
          for (int i=0; i < table1.getColumnCount(); i++) {
            TableColumn col = colmod.getColumn(i);
            col.setPreferredWidth(50);
          //create an edit field
          JEditorPane jep1 = new JEditorPane();
          jep1.setPreferredSize(new Dimension(100, 20));
          //create the panel & add two components
          JPanel p = new JPanel();
          p.setPreferredSize(this.getSize());
          double size[][] =
            {{10, TableLayout.PREFERRED, 10},  // Columns
             {10, TableLayout.PREFERRED, 10}}; // Rows
          TableLayout tl = new TableLayout(size);
          p.setLayout(tl);
          p.add(table1, "1, 1");
          p.add(jep1, "1, 2");
          validate();
          setVisible(true);
        catch(Exception e) {
          e.printStackTrace();
      public static void main(String[] args) { new AFrame(); }
    //The TestTableModel dummy class for testing
    public class TestTableModel extends AbstractTableModel  {
      public TestTableModel() {
      public int getRowCount() {
        return 2;
      public int getColumnCount() {
        return 10;
      public Object getValueAt(int row, int col) {
        return "Test value";
    }

  • Dynamic SORT with multiple components

    Hi all,
    I want to sort an internal table in this way:
    SORT itab BY (component).
    This is not difficult if "component" contains the name of ONE column of itab. But - and here is my problem - how can I sort with multiple components?
    Like this:
    SORT itab BY (comp_1) (comp_2) ... (comp_N).
    The number of components (N) shall be flexible. It is not possible to concatenate the components into one string-variable. This causes an error ITAB_ILLEGAL_COMPONENT.
    Brillant would be a solution which also contains the sort-direction (ASCENDING or DESCENDING for each component like this:
    SORT itab BY (comp_1) (dir_1)
                 (comp_2) (dir_2)
                 (comp_N) (dir_N).
    Is there a way to do so?
    Thanks for all hints!
    Mathias

    Hi Matahias ...
    From ABAP help...
    SORT itab.
    Extras:
    1. ... BY f1 f2 ... fn
    2. ... ASCENDING
    3. ... DESCENDING
    4. ... AS TEXT
    5. ... STABLE
    The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Field symbols not allowed as sort criterion.
    Effect
    The entries in the internal table are sorted in ascending order using the key from the table definition (DATA, TYPES).
    Addition 1
    ... BY f1 f2 ... fn
    Effect
    Uses the sort key defined by the sub-fields f1, f2, ..., fn of the table itab instead of the table key. The fields can be of any type; even number fields and tables are allowed.
    You can also specify the sort fields dynamically in the form (name). If name is blank at run time, the sort field is ignored. If itab is a table with a header line, you can also use a field symbol pointing to the header line of itab as a dynamic sort criterion. A field symbol that is not assigned is ignored. If a field symbol is assigned, but does not point to the header line of the internal table, a runtime error occurs.
    If the line type of the internal table contains object reference variables as components, or the entire line type is a reference variable, you can use the attributes of the object to which a reference is pointing in a line as sort criteria (see Attributes of Objects as the Key of an Internal Table
    You can address the entire line of an internal table as the key using the pseudocomponent TABLE_LINE. This is particularly relevant for tables with a non-structured line type when you want to address the whole line as the key of the table (see also Pseudocomponent TABLE_LINE With Internal Tables).
    If you use one of the additions 2 to 5 before BY, it applies to all fields of the sort key by default. You can also specify these additions after each individual sort field f1, f2, ..., fn. For each key field, this defines an individual sort rule which overrides the default.
    Cheers
    Preetham

  • How to move multiple components into a Tab Component and still keep layout?

    I have created a Combination Chart with multiple combo boxes and a slider on my Xcelsius Canvas.  Now, I realize that I want to put all of this into a Tab Set Component.  How can I move everything into this new Tab Component without messing up all the layout and alignment I have done on all my components already?  I tried shift-selecting everything and doing a drag --> drop into the Tab Canvas but they just all stack on top of each other.
    Can this be done?  Would it be wiser to start a new Xcelsius document, place a Tab Set Component on the canvas and then copy --> paste from the original document into the new one? I'm reluctant to do this though (even within the same document) because it forces all components to be renamed back to their defaults such as Chart 1, Combo Box 1, etc etc.
    Edit:
    Bolded my biggest concern on this topic, can components be copy/pasted or cut/pasted and still retain their original name?

    i think this scenario would work fine for you
    choose all the components you want to move from the "Object Browser"
    you can show the Object Browser from the View Menu
    after you select them all, you can drag them to your Tab component
    or you can make them as a group, so it will be easy to move them as the same layout they have.
    to make them as one group
    select them all, go to format menu, and select Group
    now you have all of them as one item, move them to the tab and then you can ungroup them the same way
    good luck
    Amr

  • Question about adding multiple components....

    .....HI, i really hope someone can help out......
    When I try to add mutilple components to the panel, it won't show the components that I have added before again.....
    For example, I have a Icon Label and I want it to show two of the same Label again in the panel.... but it won't... it will just show one of them....
    for example:
    Label[] dice = new Label[6]
    Icon bug[] = new Icon[6];
    String dicePics[] = {"1.jpg", "2.jpg","3.jpg",
    "4.jpg","5.jpg","6.jpg",};
    for(int i=0; i<6; i++){
    bug[i] = new ImageIcon(dicePics);
    dice[i] = new JLabel();
    dice[i].setIcon( bug[i] );
    userPanel.add(dice[0]);
    userPanel.add(dice[0]);
    This will only show dice[0] once in panel........ how can I show the same things over again in a panel more then once.........?? I also try it on other things... when adding a component with same name, it will just show one of them.......... wondering if someone can help me out.......

    .....HI, i really hope someone can help out......
    When I try to add mutilple components to the panel,
    it won't show the components that I have added before
    again.....
    For example, I have a Icon Label and I want it to
    show two of the same Label again in the panel.... but
    it won't... it will just show one of them....
    for example:
    Label[] dice = new Label[6]
    Icon bug[] = new Icon[6];
    String dicePics[] = {"1.jpg", "2.jpg","3.jpg",
    "4.jpg","5.jpg","6.jpg",};
    for(int i=0; i<6; i++){
    bug[i] = new ImageIcon(dicePics);
    dice[i] = new JLabel();
    dice[i].setIcon( bug[i] );
    l.add(dice[0]);
    userPanel.add(dice[0]);
    This will only show dice[0] once in panel........ how
    can I show the same things over again in a panel more
    then once.........?? I also try it on other
    things... when adding a component with same name, it
    will just show one of them.......... wondering if
    someone can help me out.......
    You can't add the same GUI object to a Container multiple times. The problem is with your design. Consider something like this:
    import java.awt.BorderLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.Random;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    public class DieLabelTest {
        private Random rand = new Random();
        private final JLabel[] dies = new JLabel[6];
        DieLabelTest() {
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            JPanel diePanel = new JPanel(new GridLayout(3,0,5,5));
            for (int i = 0; i < 6; i++) {
                dies[i] = new JLabel();
                dies.setIcon(DieIconProvider.getIcon(rand.nextInt(6) + 1));
    diePanel.add(dies[i]);
    f.add(diePanel, BorderLayout.CENTER);
    JButton rollButton = new JButton("Roll");
    rollButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent ae) {
    for (int i = 0; i < 6; i++) {
    dies[i].setIcon(DieIconProvider.getIcon(rand.nextInt(6) + 1));
    f.add(rollButton, BorderLayout.SOUTH);
    f.pack();
    f.setVisible(true);
    public static void main(String[] args) {
    new DieLabelTest();
    class DieIconProvider {
    private static Icon[] icons = new Icon[6];
    public static synchronized Icon getIcon(int num) {
    if (icons[num - 1] == null) {
    icons[num - 1] = new ImageIcon(num + ".jpg");
    return icons[num -1];

  • Printing a multipage document containing multiple Components

    Hi everybody,
    I am trying to print a multipage document which consists of multiple JPanels used for grouping, each of which hold JLabels and JScrollPanes and JTextAreas.
    I know how to do multipage printing with text but I am lost with the multi component situation.
    Thanks in advance for any help.
    vh

    If you know how many pages are in use, get the size of the page (the pageformats imageable height * page number) and with that number translate the page up that number of pixels. ( the translate method of graphics ). Then you can draw all the components on the page. Make sure you translate before you draw, this mistake took me a day to figure out. Hope this helps.

  • How do i add multiple components to a scrollpane?

    i have found info and examples on using a jpanel within the scroll pane, but i am still having difficulties. i put multiple componets (textarea's and so forth) into the panel and when i run the application the scrollable area does not work - show all of the panel? any ideas? thanks for any help!

    Since there is no code attached, I assume that your mistake is that you simply did something like:myScroll.add(myPanel)This doesn't work, since you have to add the panel to the viewport and not the scroll pane itself. Do this instead:myScroll.getViewport().add(myPanel);Or, there is a better version - just put it in creation:
    myScroll = new JScrollPane(myPanel);This is better since you need to bear in mind that there should be only one component in the scroll pane's viewport.
    If you want to replace it during run time, you need to remove the component from the viewport and add the new one: myScroll.getViewport().remove(oldPanel);
    myScroll.getViewport().add(newPanel);Good luck!
    - Moti

  • How to display multiple components in a single tabstrip with different tabs

    Hi Experts,
    I am working on PM UI development. We have created 5 webdynpro components and all have seperate application and link to run. Now we have requirement in which we should have a single window and all components should exist in different tabs.
    Till now I have used Tabstrip in a single copmponent and have no idea how to fix this issue. Could you please help me out to get this done ASAP.
    Thanks in advance.
    Madhu Omer

    Hi Madhu,
    One option that you can try now is to create a new webdnpro component with a tabstrip.
    1. To each of the tab area you attach view container.
    2. In the used components of webdynpro component tab you can add each of the components that you created
    3. Create inboud plugs for each of these application that you created.
    4. When the tab is pressed trigger a call to the inbound plug of the applications
    5. You can refer the following also https://cw.sdn.sap.com/cw/docs/DOC-24752
    All the Best !

  • Multiple Components in a JFrame (simple question)

    Hello everyone, I need to put two components in my JFrame, and I have been expieriencing some odd problems. I use this to add my components...
    MyComponent mc=new MyComponent();
    MyOtherComponent me = new MyOtherComponent();
    When I try to access methods they work fine. I can use repaint() in a method and it works. BUT when I try to draw on the component using anything besides paintComponent() It gives me a java.lang.NullPointerException
    here is what I tried.....
    me.draw(getGraphics());
    //later on in the component def..
    draw(Graphics g) {
    } // I get a java.lang.NullPointerException in main
    whenever i use getGraphics() it does'nt work what am I doing wrong?

    Yup I did that and repaint does jack all. When I run the code all I see the contents of the first component. I know that the methods of the second component are being executed, but the paintComponent method is simply not running. I put a System.out.println("hi"); in and it never showed in the console..
    Anyone who can help me gets a duke, here's my second component code..
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    class MyOtherComponent extends JComponent {
    public void paintComponent(Graphics gg) {
    System.out.println("paintComponent executed!!!");
    Graphics2D g2D = (Graphics2D)gg;
    ImageIcon icon = null;
    try {icon = new ImageIcon(new URL("http://images.neopets.com/m.gif")); }
    catch(MalformedURLException e) {
    System.out.println("no"); return;
    resize(icon.getIconWidth(),icon.getIconHeight());
    Image mark = icon.getImage();
    g2D.drawImage(mark,0,0,this);
    g2D.drawString("hello folk",40,40);
    drawe(g2D);
    public void drawe(Graphics2D g2D) {
    g2D.drawLine(50,50,500,500);
    g2D.fillRect(20,20,20,20);
    repaint();
    public void line() {
    System.out.println("Hello, from MyOtherComponent");
    public void re() {
    repaint();
    System.out.println("re");     
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Maybe you are looking for