Thin borderlines for JText cells

Hi,
The following example makes a table based on JTextFields.
I would like to get thinner border lines as they are in a JTable.
Who knows how?
Thanks
Michel
package MTabProtoypes;
import java.awt.Color;
import java.awt.Container;
import java.awt.HeadlessException;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JTextField;
/* @author scm */
public class TabJtextfieldsArray02 extends JFrame implements MouseListener {
     private JTextField[][] txt;     // View: 2D Array of textfields o=o 2D model array 
     private Container cp = getContentPane();
     public static void main(String[] args) {
          int totRows = 256; int totCols=64; int visRows = 16; int visCols=8; int x=10; int y=10; int h=20; int w=70; 
          TabJtextfieldsArray02 mTabTest = new TabJtextfieldsArray02(totRows,totCols,visRows,visCols,x,y,w,h);          // Neue Table
         mTabTest.setSize(600, 400);    
         mTabTest.setVisible( true );
     public TabJtextfieldsArray02(int totRows, int totCols, int visRows, int visCols, int xpos, int ypos, int width, int height) throws HeadlessException {
//          super ("Tabellen - TabJtextfieldsArray02");
         cp.setLayout( null );
         txt = new JTextField[totRows][totCols]; // Table / Textfield-Array Params (rows/columns)
         for (int i = 0; i < visRows; i++) {appRow (i, visCols, xpos, ypos, width, height);}     // append row by row
            for (int i = 1; i <=visCols; i++) {insText (1,i,"ColHead "+i);}               // Index  Not 0/0, but 1/1, including header
            for (int i = 1; i <=visCols; i++) {setLineAttrib (1,i,1);}                    // Header (light gray)
            cp.addMouseListener((MouseListener) this);
     private void appRow (int row, int visCols, int x, int y, int w, int h) {     // build column row by row
          for (int j = 0; j < visCols; j++) {
               txt[row][j] = new JTextField();     
               txt[row][j].addMouseListener(this);
//               txt[row][j].setBorder(BorderFactory.createEmptyBorder());               // no border
//               if ((j+1)%2==0) {                                                                 // trial with only odd rows - forget it
//                    txt[row][j].setBorder(BorderFactory.createRaisedBevelBorder()); // border
//               } else {
//                    txt[row][j].setBorder(BorderFactory.createEmptyBorder());          // no border
               txt[row][j].setBorder(BorderFactory.createRaisedBevelBorder());
//               txt[row][j].setBackground(Color.lightGray );
//               txt[row][j].setForeground(Color.gray);
//               txt[row][j].setBorder(BorderFactory.createLoweredBevelBorder());
//               txt[row][j].setBorder(BorderFactory.createLineBorder(Color.black));          // Thickness = 1
//               txt[row][j].setBorder(BorderFactory.createLineBorder(Color.black,1));       // Color, Thickness
//               System.out.println(txt[row][j].getBorder());
//               txt[row][j].setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.black));
//               txt[row][j].setBorder(BorderFactory.createEtchedBorder());
//               txt[row][j].setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED )); //
               txt[row][j].setBounds(x+j*w,y+y*2*row,w,h);          
//               txt[row][j].setBounds(x+j*(w-1),y+y*2*row,w,h);     
               cp.add(txt[row][j]);
//     Text in ein Tabellenfeld einf�gen
     private void insText (int row, int col, String tabField) {
          txt[row-1][col-1].setText(tabField);
//     Eine Tabellenelement bekommt ein bestimmtes Aussehen
     public void setLineAttrib (int row, int col, int attrib) {
          switch (attrib) {
          case 1:          // Hintergrund grau
               txt[row-1][col-1].setBackground(Color.lightGray);     
               break;
          default:
               break;
     public void mouseClicked(MouseEvent arg0) {
          System.out.println("mouseClicked: "+arg0);
     public void mouseEntered(MouseEvent arg0) {
          System.out.println("mouseEntered: "+arg0);
     public void mouseExited(MouseEvent arg0) {
          System.out.println("mouseExited: "+arg0);
     public void mousePressed(MouseEvent arg0) {
          System.out.println("mousePressed: "+arg0);
     public void mouseReleased(MouseEvent arg0) {
          System.out.println("mouseReleased: "+arg0);
}

but I don't know why.you had a border for each 'cell', meaning between adjacent 'cells' there were 2 borders,
right side of one adjoining left side of adjacent
likewise for bottom/top
the matte border allows you to specify 0 pixels wide for top/left/bottom/right,
meaning the overall 2 borders are 1 pixel wide
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/BorderFactory.html#createMatteBorder(int,%20int,%20int,%20int,%20java.awt.Color)

Similar Messages

  • Why do borders for some cells allow changes in line thickness, but other cells are locked in only one thickness?

    It looks like you should be able to choose different line thickness for cell borders, but for some cells you can get three choices (0.5, 1, 2 pt), but in other cases you can only do 0.5?
    I can't make a consistent thickness border around the outside of all my cells!

    VS,
    Yes, I have lots of ideas. After all that work you probably don't want to hear them.
    1. I would use PDF versions of rotated text boxes, inserted into the cells as background Fill rather than floating the actual text boxes over the table.
    2. I would never merge a cell, or divide, a cell. Too many problems await you down the road if you do that. There are many ways in Numbers to avoid having to do those things. These are things we must do in Excel to get by, but we don't have to do them in Numbers.
    3. There is a Line Type called "Thin" that has only one size, and another line type shown as a heavier solid for which the weight can be adjusted. It's possible that you have some places where you need to change the line type.
    I believe that your difficulty may come from the merging of cells causing some ambiguity as to which border needs to be selected to change the display. This would be a bug, because you should be able to just select the border and edit it, but your table may have become so complex that the program has lost track of things in the course of all your changes.
    My suggestion is to print your table just as it is, for reference, and start over in a new document, not an imported one. Don't merge or split. Use multiple simple tables and the occasional text box for annotation. You will be on your way to doing things the "Numbers Way".
    Jerry

  • Display Color for sigle  CELL in ALV report

    Hi all,
    I have one doubt is it possible to make a particular cell as read color in ALV.
    Ex: I have one field which shows amount in my ALV report,My requirement is that when ever the amount is less then 'ZERO', I have to show that particular cell in read color.
    Regards
    Anil Kumar.N

    hi,
    here code for coloring a perticular cell
    TYPE-POOLS:slis.
    TABLES:mara,
           makt,
           marc.
    DATA:BEGIN OF itab OCCURS 0,
          matnr LIKE mara-matnr,
          maktx LIKE makt-maktx,
          werks LIKE marc-werks,
          mtart LIKE mara-mtart,
          matkl LIKE mara-matkl,
          meins LIKE mara-meins,
          ntgew LIKE mara-ntgew,
         rowcolor(4) TYPE c,
          cellcolors TYPE lvc_t_scol,
         END OF itab.
    DATA:t_fcat TYPE slis_t_fieldcat_alv,
         t_eve TYPE slis_t_event.
    DATA : st_layout TYPE slis_layout_alv.
    SELECTION-SCREEN:BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS:mat FOR mara-matnr.  " no intervals no-extension.
    *PARAMETERS:mat LIKE mara-matnr.
    SELECTION-SCREEN:END OF BLOCK blk1.
    INITIALIZATION.
      PERFORM build_cata USING t_fcat.
      PERFORM build_event.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM display_data.
    *&      Form  build_cata
          text
         -->TEMP_FCAT  text
    FORM build_cata USING temp_fcat TYPE slis_t_fieldcat_alv.
      sy-tvar0 = sy-uname.
      WRITE sy-datum TO sy-tvar1.
      DATA:wa_fcat TYPE slis_fieldcat_alv.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'MATNR'.
      wa_fcat-seltext_m = 'Material'.
      APPEND wa_fcat TO temp_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'MAKTX'.
      wa_fcat-seltext_m = 'Description'.
      wa_fcat-fix_column = 'x'.
      wa_fcat-key = 'X'.                                     "To color a column
      APPEND wa_fcat TO temp_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'WERKS'.
      wa_fcat-seltext_m = 'Plant'.
      wa_fcat-key = ' '.
      APPEND wa_fcat TO temp_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'MTART'.
      wa_fcat-seltext_m = 'Type'.
      APPEND wa_fcat TO temp_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'MATKL'.
      wa_fcat-seltext_m = 'Group'.
      APPEND wa_fcat TO temp_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'MEINS'.
      wa_fcat-seltext_m = 'Measurement Unit'.
      APPEND wa_fcat TO temp_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'NTGEW'.
      wa_fcat-seltext_m = 'Net Value'.
      APPEND wa_fcat TO temp_fcat.
    ENDFORM.                    "build_cata
    *&      Form  build_event
          text
    FORM build_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type     = 0
        IMPORTING
          et_events       = t_eve
        EXCEPTIONS
          list_type_wrong = 1
          OTHERS          = 2.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "build_event
    *&      Form  data_retrieval
          text
    FORM data_retrieval.
      SELECT maramatnr  maramtart maramatkl marameins mara~ntgew
       maktmaktx  marcwerks
      INTO CORRESPONDING FIELDS OF TABLE itab
      FROM mara INNER JOIN makt ON
      maramatnr = maktmatnr
      INNER JOIN marc ON
      maramatnr = marcmatnr
      WHERE mara~matnr IN mat.
      SORT itab BY matnr.
      DELETE ADJACENT DUPLICATES FROM itab.
    ENDFORM.                    "data_retrieval
    *&      Form  display_data
          text
    FORM display_data.
    *******************************For setting Cell Color*******************************************
      DATA ls_cellcolor TYPE lvc_s_scol .
      st_layout-coltab_fieldname = 'CELLCOLORS'.
      READ TABLE itab INDEX 5 .
      ls_cellcolor-fname = 'MATNR' .
      ls_cellcolor-color-col = '1' .
      ls_cellcolor-color-int = '1' .
      APPEND ls_cellcolor TO itab-cellcolors .
      MODIFY itab INDEX 5 .
    st_layout-colwidth_optimize = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = 'ZALV_DS'
          is_layout          = st_layout
          i_save             = 'A'
          it_fieldcat        = t_fcat
          it_events          = t_eve
        TABLES
          t_outtab           = itab
        EXCEPTIONS
          program_error      = 1
          OTHERS             = 2.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "display_data
    Please reward if useful...

  • How to configure oracle thin drivers for SUN APPLICATION SERVER

    hi all,
    I am working with EJB with oracle as back-end. I wants to know how to configure oracle thin drivers for the SUN APPLICATION SERVER. Please explain me breifly.
    Advanced thanks to all the replies.
    with regards,
    /kumaraswamy.n

    Kumaraswamy,
    Did you try searching the Internet? Here are the results of my Internet search:
    http://tinyurl.com/zo4gk
    And one of the first hits in the list was this:
    Deploying to a Sun Java System Application Server
    Good Luck,
    Avi.

  • JDBC thin drivers for oracle 8.0.5 for linux

    I want to use Java SDK 1.2.2 and need the oracle thin drivers.
    I have trouble with the 816 thin drivers connecting to the 8.0.5
    server.
    when using statement.executeQuery(..... I get the following
    Exception.
    Exception error: java.sql.SQLException: ORA-03120: two-task
    conversion routine:integer overflow
    I think my solution is to upgrade to a 8.1.6 server or use the
    java 1.1.6 driver on the JDK1.1.6
    I tried downoading the 8.1.5 enterprise server but this fails to
    complete.
    Can someone help me to this version on CDROM or to the JDBC thin
    driver for the 8.0.5 server?
    null

    You must include "classes12.zip" instead of "classes111.zip".
    Since "classes111.zip" is required only for Java 1
    and "classes12.zip" is required for Java 2 which means from J2SE 1.2 on forward.
    In adition you might need to inlcude "nls_charset12.zip" as well. Try it first without and if it is not working include it as well.
    The required files can you get from the OTN.
    This should help
    Roger

  • I am having trouble getting a numbers spreadsheet to hold different formats in the same column.  A column with a date formatted heading will not convert to $ for the cells below.   Any suggestions would help.

    I am having trouble getting a numbers spreadsheet to hold different formats in the same column.  A column with a date formatted heading will not convert to $ for the cells below.   Any suggestions would help.

    Hi Wayne,
    Thank you for this response.  I have tried this but when I start enterring $ amounts some, such as $6.00, go in OK others such as $4.00 appear as a date ie 4 Oct 12.  
    Kind regards
    Paul

  • How can i apply different color for each cell in jlist component?

    hi guys i need your help and sorry if my english is very bad..guys how can i apply different colors for each cell in jlist component? for example for the first cell i want to apply color blue, for the second cell i want red, etc... i need your answer guys tnx..
    Edited by: ryrene on Mar 21, 2010 12:13 AM

    ryrene wrote:
    hi guys i need your help and sorry if my english is very bad.
    ..guys how can i apply different colors for each cell in jlist component? for example for the first cell i want to apply color blue, for the second cell i want red, etc... i need your answer guys tnx..I'll see your tnx, and raise you dve bmbrs & nplm.

  • Is there an app for blocking cell calls

    Is there an app for blocking cell calls?

    There is not.  Look to your right under "More Like This" for related discussions.

  • Change Capitalization For Many Cells at Once

    How can I change the captialization for many table cells at once. I can do it for one cell at a time by triple-clicking an choosing the capitalization menu within fonts, but if I select all the cells I want to change and then go to fonts>capitalization, the capitalization menu is dimmed.
    thanks,
    Jeff

    I'm a little confused by this thread. As Badunit describes, can't you just select multiple cells and make a menu pick?
    No need for formulas, right?  (unless it's a special situation of capitalizing the start of each sentence)
    SG

  • MicroSD card for my cell

    I've got a SanDisc MicroSD card for my cell phone, which is a LG VX8300. I've had no luck getting music to play on the phone yet, but thats another issue. Today I plugged the card into my iMac, and it says I can only read, not write. How can I change this?! It didn't say that before, I don't know what changed. I tried putting the card back into my phone and formatting it, but no luck. Please help!

    zkatrina1017, Welcome to the discussion area!
    Did you happen to format the card as NTFS? The Mac
    can read NTFS but not write to it.
    My phone doesn't give an option as to the format, so I'm not sure what format it has, when I view the information it says this is the format: "MS-DOS File System (FAT16)"...I've formatted the card before and its allowed me to both read and write...I'm stumped.

  • Oracle JDBC Thin Driver for oracle 9.2.0.4

    Hi,
    It would be nice if someone please guide me to the download of Oracle JDBC Thin Driver for oracle 9.2.0.4.
    Thanks in anticipation

    user566773,
    As far as I know, all Oracle JDBC drivers are meant to be backward compatible.
    According to the table on the following Web page, the latest Oracle JDBC driver can be used with Oracle 9.2.0.x DBMS.
    http://www.oracle.com/technology/tech/java/sqlj_jdbc/index.html
    Good Luck,
    Avi.

  • JDBC thin driver for oracle 7.1.3

    Hi,
    we r using Oracle 7.1.3. i would like to know where i can get the
    thin driver for java compatible with the oracle version 7.1.3 so
    that i need not install an oracle client in the clients pc.
    thanks
    veera
    null

    Jay (guest) wrote:
    : BUBBA (guest) wrote:
    : : Veera Nagendran (guest) wrote:
    : : : Hi,
    : : : we r using Oracle 7.1.3. i would like to know where i can
    : get
    : : the
    : : : thin driver for java compatible with the oracle version
    : 7.1.3
    : : so
    : : : that i need not install an oracle client in the clients pc.
    : : : thanks
    : : : veera
    : : Thedatabase you're using went out of support over 2 years
    ago.
    : : oracle doesn't provide jdbc drivers for anything less than
    : : supported version 7.3.4.
    : So why does Oracle make this claim
    : "The Thin driver does not require Oracle software on the client
    : side. It connects to any Oracle database of version 7.2.x and
    : higher. The driver requires a TCP/IP listener on the server
    : side. " ???
    : Jay
    re-read my earlier reply -- the comment was :
    Thedatabase you're using went out of support over 2 years
    ago. oracle doesn't provide jdbc drivers for anything less
    than the minimum supported version ---> 7.3.4.At no time did i refer to the client s/w being required !!
    also it was not tested against unsupported version of the
    rdbms ...
    also rdbms 7.1.3 isn't y2k compliant.
    use it at your own risk..
    what "claim" are you saying oracle made ??
    null

  • JDBC thin drivers for 8.0.4 and JDK 1.2

    Hello.
    I3d like to know when will be released the JDBC thin drivers for
    Oracle 8.0.4, compatible with the JDK 1.2. I need it to use the
    new Java BLOB features of the JDK 1.2. Thanks.
    null

    Marcelo,
    You can download JDBC 2.0 - friendly drivers from Openlink
    Software (http://www.openlinksw.com). Our latest 3.2 versions
    that support JDK 1.2 can be found at
    ftp://ftp.openlinksw.com/pre-3.2/index.html
    ... if you scroll to the NT / 95 section at the bottom of the
    page, you'll find the "opljdbc2.jar" in the list.
    Best regards,
    Stephen
    Marcelo Malagutti (guest) wrote:
    : Hello.
    : I3d like to know when will be released the JDBC thin drivers
    for
    : Oracle 8.0.4, compatible with the JDK 1.2. I need it to use
    the
    : new Java BLOB features of the JDK 1.2. Thanks.
    null

  • Thin driver for SQL server 2000

    Hi,
    Is there a thin driver for SQL server 2000?
    If so where can i find it?
    I searched the net but in vain.
    thanx in advance
    Partha

    Did you try the search engine available at the java soft site
    http://industry.java.sun.com/products/jdbc/drivers
    I used this engine some time ago and found that the thin driver at http://www.inetsoftware.de was the best fit for our project.
    hope this helps.
    regards,
    Abhishek.

  • Reports 9i/10g J2EE Thin Client for Websphere Application Server 5.x /6.x

    We are having Reports developed in 6i which needs to be migrated to Reports 9i/10G and we want to deploy these reports in web using Websphere Application Server 5.x /6.x without Oracle iAS.
    Do we have Reports 9i/10g J2EE Thin Client for Websphere Application Server 5.x /6.x and if so please let me know.
    Also if anybody has the configuration details please let me know?
    Thanks in Advance.

    No there is not. I don't think you can use reports services with Websphere - besides as far as I know it is not supported by Oracle (not anywhere in their support matrix).

Maybe you are looking for

  • Calling BPEL WSDL in ESB

    Hi, Firstly I am new to BPEL. This question might be very simple. I need the solution ASAP. Coming to the usecase. I have one service "A" in ESB and other service "B" in BPEL. To make it simple I need to listen a file using a file adapter in service

  • ABAP OO BOR export parameter

    Hi, All! I am beginner at ABAP OO in workflow and get a problem with using BOR in OO methods. Exporting parameter of the method typed as OBJ_RECORD. In workflow builder (method container) this   parameter displays as reference to BOR, but has not exa

  • How to create a database (file.mdb)?

    Hello. I'm trying to create a .mdb database (Access) with Java but dont know how. How can i create a database if I need to be connected to an existing database? public class JavaApplication1 { * @param args the command line arguments public static vo

  • Page "Display Trip Form"

    Hi All. I am implementing ESS/MSS for Travel expense. I want to use iView and Page "Display Trip Form". This iview and page is in Portal contend directory :Portal COntent -> Content provided by SAP -> End user content -> ESS -> Pages -> Travel and Ex

  • Camera wireframe icon missing in 3d  perspective view!!!

    Dear Motion masters, I cant solve this problem and find it very tricky: I wanted to do some nice camera animation in 3d view, but after looking some tutorials I realized that my camera icon is missing which is really annoying as it gives real feel of