Rames Raja

Greenhorn
+ Follow
since Jan 27, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rames Raja

Hi all,
I am trying to print a table from an applet.
I am getting an access accessControlException.
How do I solve this problem ??
Thanks
Ramesh
21 years ago
Hi all,
I am passing a JScrollPane from my applet to a JDialog so that I can display the same table that resides inside my JScrollPane.
My dialog is displaying the JScrollPane well , but it seems like my JScrollPane is being removed from my original applet. Applet no longer displays the JScrollPane.
Here is how I call my JDialog
new PrintDialog( new javax.swing.JFrame(),true ,VSW_scrollPane ,this ).show();

and inside my PrintDialog I am adding VSW_scrollPane ( js ) to a panel:
middlePanel.add(js , java.awt.BorderLayout.CENTER);

what you think the problem is ??
Thanks in advance.
Ramesh
21 years ago
Hi,
I am trying to send mail using SMTP server in java.
But my SMTP only allows valid users to send mails so I need to pass my user name and password to my SMTP server.
How do I do this ?
Thank you
Ramesh
Hi All,
I am developing an Applet that uses some icons. When I attach an icon to a button and runs the applet, i get access denied problem.
How do i get around this ??
many thanks in advance.
Ramesh
21 years ago
Hi all,
I am in an urgent need to implement a JTable where each cells will contain multiline text. When text content exceeds my cell size I want a JScrollbar to appear so that I can see the entire content inside my table cell.
I desperately need help on this, please help me out.
many thanks in advance.
Ramesh
21 years ago
Hi Friends,
I am developing an applet that uses JDialog class. I want to get rid of "Java Applet Window" that appears at the bottom of my JDialog.
When I run my application from the web, I do not want that to show up.
Is there any way of doing it ?
Many thanks in advance.
Ramesh
21 years ago
Hi all,
I am desperate and I need your help asap.
I have a JTable that uses JTextPane as Cell Renderer. This is what I want:
1. I want to have multiline text inside JTextPane
2. I want a scrollbar to scroll down if my text size exceeds my cell height.

Right now, my scroll bar is not moving. Can anyone help me with this ??
Here I am posing all my classes ( 4 of them ). If you compile and run it, you will see JTable cells with scrollbars, but ScrollBar not move when you try to scroll down or up.
Your help is very much appreciated in advance.
Ramesh
This is my main program
-----------------------
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;
public class JTableTextPane extends JFrame {

// Member variables
private JPanel topPanel;
private JTable table;
private JScrollPane scrollPane;

/** Creates a new instance of TableTest */
public JTableTextPane() {


// set the frame characteristics
setSize( 300 , 200 );

// Create a panel to hold other components
topPanel = new JPanel();
topPanel.setLayout( new BorderLayout() );
getContentPane().add( topPanel );

// Create a table
table = new JTable( new TextPaneModel() );
//table = new JTable ( dm );
table.setRowHeight( 40 );
table.setEnabled( true );

//table.setEnabled( false );
table.addMouseListener(new JTextPaneMouseListener( table ));

addRenderer();
// add the table to scrollpane
scrollPane = table.createScrollPaneForTable( table );
topPanel.add( scrollPane, BorderLayout.CENTER );

}

private void addRenderer(){

TableColumn c = table.getColumnModel().getColumn( 0 );
c.setCellRenderer( new JTextPaneCellRenderer() );


}

public static void main( String args[] ){

JTableTextPane jtableTextPane = new JTableTextPane();
jtableTextPane.setVisible( true );

}

}

This is my table cell renderer class
-------------------------------------

//Imports
import java.io.*;
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
import javax.swing.border.*;
import javax.swing.JTextPane.*;
public class JTextPaneCellRenderer
extends JTextPane
implements TableCellRenderer {
/** Creates a new instance of ModifyScheduleCellRenderer */
public JTextPaneCellRenderer() {
}

public java.awt.Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column ) {

setText( value.toString() );
JScrollPane jp = new JScrollPane( this );
return jp;

}


}

This is my mouse Listener class
--------------------------------
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;
public class JTextPaneMouseListener implements MouseListener{
private JTable __table;

/** Creates a new instance of JTextPaneMouseListener */
public JTextPaneMouseListener( JTable table ) {

__table = table;
}

private void __forwardEventToButton(MouseEvent e) {
TableColumnModel columnModel = __table.getColumnModel();
int column = columnModel.getColumnIndexAtX(e.getX());
int row = e.getY() / __table.getRowHeight();
Object value;
JTextPane textPane;
MouseEvent textPaneEvent;
MouseEvent jsEvent;
JScrollPane js ;
if(row >= __table.getRowCount() || row < 0 ||
column >= __table.getColumnCount() || column < 0)
return;

value = __table.getCellRenderer( row, column );
if(!(value instanceof JTextPane ))
return;
textPane = (JTextPane)value;
textPaneEvent =
(MouseEvent)SwingUtilities.convertMouseEvent( __table, e, textPane );
textPane.dispatchEvent( textPaneEvent);

// This is necessary so that when a button is pressed and released
// it gets rendered properly. Otherwise, the button may still appear
// pressed down when it has been released.
__table.repaint();

}

public void mouseClicked( MouseEvent e ) {

__forwardEventToButton(e);
}

public void mouseEntered( MouseEvent e ) {

__forwardEventToButton(e);
}

public void mouseExited( MouseEvent e ) {

__forwardEventToButton(e);
}

public void mousePressed( MouseEvent e ) {

__forwardEventToButton(e);
}

public void mouseReleased( MouseEvent e ) {

__forwardEventToButton(e);
}

}

This is my table model class
-----------------------------
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;
/**
*
* @author Administrator
*/
class TextPaneModel extends AbstractTableModel {
private Object[][] __rows = {
{ "One\ntwo\nthree\nOne\ntwo\nthree\nOne\ntwo\nthree\nOne\ntwo\nthree\n"},
{ "One\ntwo\nthree\n" },
{ "One\ntwo\nthree\n"},
{ "One\ntwo\nthree\n" }
};
private String[] __columns = { "ONE" };
public String getColumnName(int column) {
return __columns[column];
}
public int getRowCount() {
return __rows.length;
}
public int getColumnCount() {
return __columns.length;
}
public Object getValueAt(int row, int column) {
return __rows[row][column];
}
public boolean isCellEditable(int row, int column) {
return false;
}
public Class getColumnClass(int column) {
return getValueAt(0, column).getClass();
}
}
21 years ago