Reply immediatelt !!!!!!!!! implement Graphics Class in application Progra
Dear Sir,
How to implement Graphics Class in an Constructor in an Application Program.
for Example
In Applet
public void init(){
Graphics g;
Dimension d;
Font f;
FontMetrics fm;
g = getGraphics();
d = size();
f=new Font("Dialog",Font.PLAIN,12);
g. setFont(f);
fm = g.getFontMetrics();
standalone Application program
Words(){
Graphics g;
Dimension d;
Font f;
FontMetrics fm;
g = getGraphics();
d = size();
f=new Font("Dialog",Font.PLAIN,12);
g. setFont(f);
fm = g.getFontMetrics();
when we try to implement in an standlone Application program it gives
Null Pointer Exception how to implement Grapics Class in an constructor of standlone Application program.
I think this is an appropriate reply for this...
Similar Messages
-
Problems implementing abstract classes
hello.
this is james mcfadden. I am developing a multiplayer BlackJack card game in Java. the game consists of three programs: BlackJack.java, BlackJackServer.java and BlackJackClient.java (three 3 programs are shown below). i don't know how to implement abstract classes. i am trying to get the BlackJack.java program working with the BlackJackServer.java program. there should be "extends BlackJackServer" somewhere in the BlackJack.java program, but i don't know where.
import javax.swing.*;
public class BlackJack extends JPanel{
public BlackJack(){
//FlowLayout is default layout manager for a JPanel
add(new JButton("Hit"));
add(new JButton("Stay"));
add(new JButton("New Game"));
public static void main(String[] args){
JFrame frame=new JFrame("BlackJack");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(500,500);
frame.setLocation(200,200);
BlackJack bj=new BlackJack();
frame.setContentPane(bj);
frame.setVisible(true);
import java.io.*;//Provides for system input and output through data streams, serialization and the file system
import java.net.*;//Provides the classes for implementing networking applications
import java.util.*;//Contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes
import java.awt.*;//Contains all of the classes for creating user interfaces and for painting graphics and images
import javax.swing.*;//Provides a set of lightweight components that, to the maximum degree possible, work the same on all platforms
public class BlackJackServer extends JFrame{
private JTextArea jta=new JTextArea();//a text area for displaying text
public static void main(String[] args){
new BlackJackServer();//invokes the constructor BlackJackServer()
}//end main
public BlackJackServer(){
setLayout(new BorderLayout());//places the text area on the frame
add(new JScrollPane(jta),BorderLayout.CENTER);//lays out a text area, arranging and resizing its components to fit in the centre region;and provides a scrollable view of a lightweight component
setTitle("BlackJack Server");//Sets the title for this frame to the specified string
setSize(500,300);//Resizes this component so that it has a width and a height
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//Sets the operation that will happen by default when the user closes this frame
setVisible(true);//shows the frame
try{
ServerSocket serverSocket=new ServerSocket(8000);//creates a server socket
jta.append("Server started at "+new Date()+'\n');//displays the current date in the text area
Socket socket=serverSocket.accept();//listens for a connection request
DataInputStream inputFromClient=new DataInputStream(socket.getInputStream());//creates a data input stream
DataOutputStream outputToClient=new DataOutputStream(socket.getOutputStream());//creates a data output stream
while(true){
float bet=inputFromClient.readFloat();//receives bet from the client
float doublebet=bet+bet;//computes double the bet
outputToClient.writeFloat(doublebet);//sends double the bet back to the client
jta.append("Bet received from client: "+bet+'\n');//displays the bet in the text area
jta.append("Double the bet found: "+doublebet+'\n');//displays double the bet in the text area
}//end while
}//end try
catch(IOException ex){
System.err.println(ex);//displays an error message
}//end catch
}//end constructor
}//end class BlackJackServer
import java.io.*;//Provides for system input and output through data streams, serialization and the file system
import java.net.*;//Provides the classes for implementing networking applications
import java.awt.*;//Contains all of the classes for creating user interfaces and for painting graphics and images
import java.awt.event.*;//Provides interfaces and classes for dealing with different types of events fired by AWT components
import javax.swing.*;//Provides a set of lightweight components that, to the maximum degree possible, work the same on all platforms
public class BlackJackClient extends JFrame{
private JTextField jtf=new JTextField();//a text field for receiving text
private JTextArea jta=new JTextArea();//a text area for displaying text
private DataOutputStream toServer;//output stream
private DataInputStream fromServer;//input stream
public static void main(String[] args){
new BlackJackClient();//invokes the constructor BlackJackClient()
public BlackJackClient(){
JPanel p=new JPanel();//holds the label and text field
p.setLayout(new BorderLayout());//sets the layout of the content pane of this component by default
p.add(new JLabel("Enter bet"),BorderLayout.WEST);//displays the bet and lays out a JLabel, arranging and resizing its components to fit in the western region
p.add(jtf,BorderLayout.CENTER);//lays out the text field, arranging and resizing its components to fit in the centre region
jtf.setHorizontalAlignment(JTextField.RIGHT);//Sets the horizontal alignment of the text to the right
setLayout(new BorderLayout());//places the text area on the frame
add(p,BorderLayout.NORTH);//lays out the text field, arranging and resizing its components to fit in the northern region
add(new JScrollPane(jta),BorderLayout.CENTER);//lays out a text area, arranging and resizing its components to fit in the centre region;and provides a scrollable view of a lightweight component
jtf.addActionListener(new ButtonListener());//invokes the ButtonListener class
setTitle("BlackJack Client");//Sets the title for this frame to the specified string
setSize(500,300);//Resizes this component so that it has a width and a height
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//Sets the operation that will happen by default when the user closes this frame
setVisible(true);//shows the frame
try{
Socket socket=new Socket("localhost",8000);//creates a socket to connect to the server
fromServer=new DataInputStream(socket.getInputStream());//creates an input stream to receive data from the server
toServer=new DataOutputStream(socket.getOutputStream());//creates an output stream to send data to the server
}//end try
catch(IOException ex){
jta.append(ex.toString()+'\n');//displays an error message
}//end catch
private class ButtonListener implements ActionListener{
public void actionPerformed(ActionEvent e){
try{
float bet=Float.parseFloat(jtf.getText().trim());//gets the bet from the text field
toServer.writeFloat(bet);//Converts the float argument to an int using the floatToIntBits method in class Float, and then writes that int value to the underlying output stream
toServer.flush();//Flushes this output stream and forces any buffered output bytes to be written out
float doublebet=fromServer.readFloat();//gets double the bet from the server
jta.append("Bet is "+bet+"\n");//displays the bet in the text area
jta.append("Double the bet received from the server is "+doublebet+'\n');//displays double the bet in the text area
}//end try
catch(IOException ex){
System.err.println(ex);//displays an error message
}//end catch
}//end method
}//end class
}//end class BlackJackClientthere should be "extends BlackJackServer" somewhere in the BlackJack.java programI very much doubt that.
It's possible you might need to create a BlackJackServer object or something like that. But I don't see the point in subclassing it. -
Return an Image from a subclass to a graphics class
Hello
I'm wondering how to return an Image generated by one class to a class which works as a graphics class. The graphics class is run from a main class. Let me make up a schedule:
Image-generator return Image -> graphics class paint
I have tried just making an Image and using the getGraphics to connect a graphics object to it, but it doesn't seem to work.
Thanks in advanceOkay, here are the pieces of code we use. (Comments are in Swedish but they are barely relevant, and explain merely basically what is happening in the program)
The applet is compilable, but there is a nullpointerexception in Elefanträknaren, at getGraphics(). Believe me, I have tried finding the solution to this already.
Spelet (main method)
import java.applet.*;
import java.awt.*;
public class Spelet extends Applet
/*Elefanträknaren testerna;*/
Ritaren ritarN;
Graphics g;
public void init()
/*testerna = new Elefanträknaren();*/
ritarN = new Ritaren(g, getSize().width, getSize().height);
setLayout(new GridLayout(1, 1));
add(ritarN);
public void start()
ritarN.startaTråd();
public void stop()
ritarN.stoppaTråd();
public void update(Graphics g)
paint(g);
}Ritaren (graphics object)
import java.awt.*;
public class Ritaren extends Panel implements Runnable
Elefanträknaren e;
Graphics g;
int bredd, höjd;
//Trådobjekt
Thread tråd;
public Ritaren(Graphics g, int bredd, int höjd)
this.bredd = bredd;
this.höjd = höjd;
e = new Elefanträknaren(bredd, höjd);
public void startaTråd()
if( tråd == null )
tråd = new Thread(this); //Skapa tråden
tråd.start(); //Kör igång
e.startaTråd();
public void stoppaTråd()
if( tråd != null )
tråd.interrupt();
tråd = null;
public void paint(Graphics g)
g.drawImage(e.getSpökbilden(), 0, 0, this);
public void update(Graphics g)
paint(g);
public void run()
while( tråd != null )
repaint();
try
Thread.sleep(33);
catch(Exception e){}
}Elefanträknaren (class generating the Image)
import java.awt.*;
import java.util.*;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
public class Elefanträknaren extends Panel implements Runnable
//Vektorn som innehåller alla Elefant-klasser
private Vector elefanterna;
//Ritobjektet för den dubbelbuffrade bilden
private Graphics gx;
//Bildobjektet för dubbelbuffringen
private Image spökbilden;
private int bredd, höjd;
//Trådvariabeln
private Thread tråd;
//Rörelsen uppdateras 30 ggr/s. RÄKNARE håller koll på när en elefant ska läggas till (efter 30 st 30-delar = 1 ggr/s)
int RÄKNARE = 30;
int ÄNDRING = RÄKNARE;
//DELAY betecknar delayen mellan två bilder/frames. 33 ms delay = 30 FPS
int DELAY = 33;
//Konstruktor
public Elefanträknaren(int bredd, int höjd)
elefanterna = new Vector();
this.bredd = bredd;
this.höjd = höjd;
//Kör igång tråden/ge elefanterna liv
public void startaTråd()
if( tråd == null )
tråd = new Thread(this); //Skapa tråden
tråd.start(); //Kör igång
//Dubbelbuffringen initieras - detta måste ligga i startaTråd()
//spökbilden = new BufferedImage(bredd, höjd, BufferedImage.TYPE_INT_ARGB);
spökbilden = createImage(bredd, höjd);
gx = spökbilden.getGraphics();
//Stoppa tråden/döda elefanterna
public void stoppaTråd()
if( tråd != null )
tråd.interrupt();
tråd = null;
//Lägg till en elefant i vektorn
private void läggTillElefant(Elefant e)
elefanterna.add(e); //Lägg till en Elefant som objekt i vektorn
Elefant temp = (Elefant) elefanterna.get(elefanterna.size()-1);
temp.startaTråd(); //Starta Elefantens tråd - ge Elefanten liv
//Sätter ihop bilden som ska sickas till Ritaren
public void uppdaterarN()
//Rensa skärmen från den förra bilden
gx.fillRect(0, 0, bredd, höjd);
for( int i = 0; i < elefanterna.size(); i++ )
Elefant temp = (Elefant) elefanterna.get(i);
gx.drawImage(temp.getBild(), temp.getX(), temp.getY(), null);
public Image getSpökbilden()
return spökbilden;
//Tråd-loopen
public void run()
while( tråd != null )
RÄKNARE++;
if( RÄKNARE >= ÄNDRING )
läggTillElefant(new Elefant(11, 50, 900));
RÄKNARE = 0;
uppdaterarN();
//repaint();
try
Thread.sleep(DELAY);
catch(Exception e){}
}Elefant (a class which Elefanträknaren turns into an Image:
import java.awt.*;
import java.util.*;
import javax.swing.ImageIcon;
public class Elefant extends Panel implements Runnable
private int x, y; //Elefantens koordinater
private int hälsa; //Elefantens hälsa
private int RÖRELSESTEG = 10;//Antal pixlar elefanten ska röra sig i sidled
private int DELAY;
//Animation
private Vector bilderna = new Vector();
private Vector bilderna2 = new Vector();
private int fas; //Delen av animationen som ska visas
private boolean framåt;
//Tråddelen
private Thread tråd;
public Elefant(int x, int y, int hastighet)
this.x = x;
this.y = y;
DELAY = 1000 - hastighet;
hälsa = 100;
framåt = true;
fas = 0; //Nollställ fasen
//Få fram bildernas namn
for( int i = 0; i <= 5; i++ )
Image temp = new ImageIcon("Z:\\Projektet\\gamal\\Projektet\\Mappen\\mediat\\png\\jumbo" + i + ".png").getImage();
bilderna.add(temp);
Image temp2 = new ImageIcon("Z:\\Projektet\\gamal\\Projektet\\Mappen\\mediat\\png\\jumbo" + i + "r.png").getImage();
bilderna2.add(temp2);
//get-variabler
public int getX() { return x; }
public int getY() { return y; }
//Kör igång tråden/ge elefanten liv
public void startaTråd()
if( tråd == null )
tråd = new Thread(this); //Skapa tråden
tråd.start(); //Kör igång
//Rör elefanten i sidled
private void rörelse()
//Animering
if( fas < 5 ) fas++;
else fas = 0;
//Flytta ner elefanten när den når en av spelets kanter
if( x >= 800 || x <= 10 ) y += 85;
//Kontrollera riktning
if( x >= 800 ) framåt = false;
else if( x <= 10 ) framåt = true;
//Positionering
if( framåt ) x += RÖRELSESTEG;
else x -= RÖRELSESTEG;
//Hämtar den aktuella bilden, och returnerar den
public Image getBild()
Image temp;
if( framåt ) temp = (Image) bilderna.get(fas);
else temp = (Image) bilderna2.get(fas);
return temp;
/* Tråd-hantering */
//Stoppa tråden/döda elefanten
public void stoppaTråd()
if( tråd != null )
tråd.interrupt();
tråd = null;
//Körs när elefanten är vid liv
public void run()
while( tråd != null )
rörelse();
try
Thread.sleep(DELAY);
catch(Exception e){}
} -
Color filling problem in fillarc() method of Graphics class
I draw a circle in a panel. The circle space is divided to more than one sectors.The sectors are filled to particular color using fillarc(int x, int y, int start_angle, int end_angle) method of java.awt.Graphics class.
When i fill the color, i faced a problem. That is i have seen the panel background Color in some pixels of thet arc spaces.
How will i fill the particular color in full arc spaces? How will i solve this problem?
Thanks for your advance reply.
Regards
Murali.Rimport java.awt.*;
import java.awt.geom.*;
import javax.swing.*;
public class ArcFill extends JPanel {
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
int w = getWidth();
int h = getHeight();
double radius = Math.min(w,h)*7/16.0;
double x = (w - 2*radius)/2;
double y = (h - 2*radius)/2;
Ellipse2D.Double circle = new Ellipse2D.Double(x,y,2*radius,2*radius);
// Fill east sector with Arc2D.
Rectangle r = circle.getBounds();
double start = -45.0;
double extent = 90.0;
int type = Arc2D.PIE;
Arc2D.Double arc = new Arc2D.Double(r, start, extent, type);
g2.setPaint(Color.red);
g2.fill(arc);
// Fill south sector.
arc.setAngleStart(-135.0);
g2.setPaint(Color.green.darker());
g2.fill(arc);
arc.setAngleStart(-225);
g2.setPaint(Color.blue);
g2.fill(arc);
arc.setAngleStart(-315);
g2.setPaint(Color.orange);
g2.fill(arc);
// Draw circle and lines.
g2.setPaint(Color.black);
g2.draw(circle);
double theta = -Math.PI/4;
double cx = circle.getCenterX();
double cy = circle.getCenterY();
for(int j = 0; j < 4; j++) {
x = cx + radius*Math.cos(theta);
y = cy + radius*Math.sin(theta);
g2.draw(new Line2D.Double(cx, cy, x, y));
theta += Math.PI/2;
public static void main(String[] args) {
ArcFill panel = new ArcFill();
panel.setPreferredSize(new Dimension(400,400));
JOptionPane.showMessageDialog(null, panel, "", -1);
} -
Provider must implement the class 'System.Web.Security.RoleProvider'.
Hi I am implementing Membership and roles security on ASP .NET 4.0 site using oracle database. Have already configured my web.config file to use oraclemembershipprovider and oracleroleprovider but whenever I am trying to create a role or a user through "Web Site Administration Tool" I get this error "Provider must implement the class 'System.Web.Security.RoleProvider'" it comes as soon as I click on create user or create/manage role links.
btw I also noticed that there is was no row in my "ora_aspnet_applications" table I manually added one line and have already given the application name which matches with web.config entry
Any help will be appreciated, is there something wrong with my installation? Also I am using latest version of ODAC.
Saadie
Edited by: user13546761 on Jan 8, 2011 9:04 AMerrr okay my bad, there was a typo in web.config
-
Abstract Graphics class ???ques???
Referring to the abstract methods within this class such as drawPolyline and drawPolygon, etc . . . it says in the documentation for Class Graphics:
"The Graphics class is the abstract base class for all graphics contexts that allow an application to draw onto components that are realized on various devices, as well as onto off-screen images."
There are no sub-class method overrides for drawPolyline and drawPolygon, for example, except for those in subclass Class DebugGraphics, which in turn call Graphics.drawPolyline and Graphics.drawPolygon - for example - at the end of the method implimentation anyway.
And besides, DebugGraphics is a swing class, and I would not be importing it in a strictly AWT application anyway.
So where is the actual code for these methods is what I am wondering?
Thanks;
~BillThe Graphics class is subclassed in JVM specific classes since rendering
graphics on different machines is going to be done differently (this
was discussed recently). So to use these methods find a suitable object
(like an image already loaded) and call getGraphics on it. This will
return a Graphics object cast from the JVM specific graphics subclass...
Steve -
How to load a java class when application is at first time browsed.
Hi
How can i load a simple java class on application startup.
For servlet it could be done using "load on startup" tag in web.xml
but how could the same be achieved for a simple java class.
ThanksHi
Code is given below....
package com;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Test {
Test()
HttpServletRequest request=null;
HttpServletResponse response=null;
RequestDispatcher requestDispatcher = request.getRequestDispatcher("a.jsp");
try {
requestDispatcher.forward(request,response);
} catch (ServletException e) {
System.out.println("success");
e.printStackTrace();
} catch (IOException e) {
System.out.println("success 1");
e.printStackTrace();
finally
System.out.println("success 2");
System.out.println("success 3");
}Web.xml :
<servlet>
<servlet-name>simple</servlet-name>
<servlet-class>com.Test</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>simple</servlet-name>
<url-pattern>/init.do</url-pattern>
</servlet-mapping>Error Trace :
org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /DispatcherTest threw load() exception
java.lang.IllegalAccessException: Class org.apache.catalina.core.StandardWrapper can not access a member of class com.Test with modifiers ""
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
at java.lang.Class.newInstance0(Class.java:344)
at java.lang.Class.newInstance(Class.java:303)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1048)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:925)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3857)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4118)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1069)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1162)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1304)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1568)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1577)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1557)
at java.lang.Thread.run(Thread.java:595) -
Exception "not implemented for class oracle.jdbc.driver.T4CNumberAccessor"
Hello I'm having some troubles dealing with 'java.sql.Date' I'm working with express edition database and I have three classes(different packages)
1.Mapper
2.Objects Class
3.ConsoleTest
I need to get an arraylist of objects, some of which contain dates, but when try to do it I get this exception
"java.sql.SQLException: Invalid column type: getDate not implemented for class oracle.jdbc.driver.T4CNumberAccessor"
Do you have any idea how I can implement the getDate method for this T4CNumberAccessor
Here are the methods that I'm using
1.Mapper
public ArrayList<Object> getAllTaskAuctions(Connection con)
ArrayList<Object> l1 = new ArrayList<Object>();
String SQLString1 = "select * from taskauction natural join tasks";
PreparedStatement statement=null;
try
//=== get taskauctions natural join tasks
statement = con.prepareStatement(SQLString1);
ResultSet rs = statement.executeQuery();
while(rs.next())
l1.add(new TaskAuction(rs.getInt(1), rs.getInt(2), rs.getInt(3),
rs.getDate(4), rs.getDate(5), rs.getInt(6)));
l1.add(new Task(rs.getInt(1), rs.getInt(2), rs.getString(3),
rs.getString(4), rs.getString(5), rs.getString(6), rs.getInt(7)));
catch (Exception exc)
System.out.println("Fail in TaskAuctionMapper - getAllTaskAuctions");
System.out.println(exc);
return l1;
2.ConsoleTest class
Connection con;
public Connection getConnection(){
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:XE", "Project", "123" );
//username/password@[/]host[:port][service_name]
catch (Exception e)
{ System.out.println("fail in getConnection()");
System.out.println(e); }
return con;
public static void main(String[] args) {
ConsoleTest ct = new ConsoleTest();
TaskAuctionMapper tam1 = new TaskAuctionMapper();
ArrayList<Object> alt1 = tam1.getAllTaskAuctions(ct.getConnection());
Iterator<Object> itr1 = alt1.iterator();
while (itr1.hasNext())
TaskAuction taskauct = (TaskAuction) itr1.next();
//Problem, exception traced to TaskAuctionMapper
System.out.println(
"Task ID: " + taskauct.getTaskid()+ ", "+
"StartDate: "+ taskauct.getStartdate()+", "+
"User ID: " + taskauct.getUserid());
}Found the answer, I shouldn't use integers as parameters of column index in the result set, but instead use String to mark the fields :)
-
Export graphic with the application
I notice on some sample application I have installed, it say do you want to install support objects or something to that affect.
How can I attach the graphic to the application export so that when I install it somewhere else I don't have to do it seporatly.Doug,
If the images are in the Shared Components > Images and specified for that application, then you can create a export file by going to Home > Application Builder > Application XXX > Export/Import > Export > Images (tab). You can then add that file to your Supporting Objects Installation Scripts. Then when you export the application, that install script will be included.
Regards,
Dan
http://danielmcghan.us
http://sourceforge.net/projects/tapigen -
Best practices on how to implement logging in custom application
In the Enterprise Manager it is possible to display/browse the content of different log files generated by the application server modules.
I have some custom web applications which currently use the log4j framework to write to log files. Is it possible to make these log files accesible for the Enterprise Manager ?
Or what is the best practice on how to implement logging in custom applications which can be browsed in the Enterprise Manager (I do not want to use system.out)I thought that this could be done. An ex- colleague did this - but he didn't tell me how to solve this.
But as it just took 10 minutes to solve this I believe it's fairly easy.
cu
Andreas -
How to use protected method of a class in application
Hi,
will u please tell me how to use protected method of class in application. (class:cl_gui_textcontrol, method:limit_text)
Thanks in advance,
Praba.Hi Prabha,
You can set the maximum number of characters in a textedit control in the CREATE OBJECT statement itself.
Just see the first parameter in the method . I mean MAX_NUMBER_CHARS. Just set that value to the required number.
Eg:
data: edit type ref to CL_GUI_TEXTEDIT.
create object edit
exporting
MAX_NUMBER_CHARS = 10
STYLE = 0
WORDWRAP_MODE = WORDWRAP_AT_WINDOWBORDER
WORDWRAP_POSITION = -1
WORDWRAP_TO_LINEBREAK_MODE = FALSE
FILEDROP_MODE = DROPFILE_EVENT_OFF
parent = OBJ_CUSTOM_CONTAINER
LIFETIME =
NAME =
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
GUI_TYPE_NOT_SUPPORTED = 5
others = 6
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
In this case, the max: number of characters will be set to 10.
I hope your query is solved.
Regards,
SP. -
Are methods in the Graphics class Thread Safe
Can methods from the Graphics class (.e.g. drawImage(), drawString(), ect..) be called from any thread? In other words, can two threads that refer to the same Graphics object step on each other methods calls?
TIA,
DB
Edited by: Darth_Bane on Apr 27, 2009 1:44 PMNo,
They are GUI activities so you should call them from the Swing Thread ( Event Disptach Thread)
Now for the JComponent the following are thread safe:
repaint(), revalidate, invalidate which can be called from any thread.
Also the listener list can be modified from any thread addListenerXX or removeListenerXX where XX is ListenerType
Regards,
Alan Mehio
London, UK -
Information about Graphics class
how will I be able to see the source code of the graphics class.
As far as I can see there's no ByteArray class in the standard API.
There are java.io.ByteArrayInputStream and java.io.ByteArrayOutputStream objects, and also there's java.util.BitSet.
The syntax for them is the same as for any other part of the language. You probably mean the API. The API is in fact well-documented, just like most of the API.
You don't need to import any package. You do need to import the classes or just refer to them with their full name (including package).
All these things are determined from reading the documentation.
Do you have any specific questions? -
Re-Implementing Standard Class's Method
Hi ,
I want to Enhance a Standard class's Method.
For this class "/SAPSRM/CL_CLL_PWL_A_SC_H" i want to write a new implementation for method "IF_POWL_FEEDER~GET_DETAIL_COMP".
This method is inherited from "/SAPSRM/CL_CLL_POWL_BASE_AGENT" and is implemented in this class.
Now if i want to write a new implementation in class "/SAPSRM/CL_CLL_PWL_A_SC_H" , how do i do it?
Regards,
Ashish ShahCreated an Implicit Enhancement of Class /SAPSRM/CL_CLL_POWL_BASE_AGENT , method IF_POWL_FEEDER~GET_DETAIL_COMP.
Solved by using import parameter I_TYPE of IF_POWL_FEEDER~GET_DETAIL_COMP method. -
Revision: 11575
Author: [email protected]
Date: 2009-11-09 11:34:57 -0800 (Mon, 09 Nov 2009)
Log Message:
Put default style declarations into one class per application or module.
Generate all the default styles in one class instead of a class for each style. The name of the style class will be based on the application or module name. An application named ?\226?\128?\156foo?\226?\128?\157 will have a style class named ?\226?\128?\156_foo_Style?\226?\128?\157. The idea is to allow applications to be compiled with different themes and get their owns styles. Currently this is not possible because a global style in both themes will have the same class name, _globalStyle. Whatever class the top-level application loads the sub-applications and modules will have to use the same class because of the flash player first-class-in-wins rule. Now each application and module will have their own style class.
QE notes: None.
Doc notes: None.
Bugs: SDK-22454
Reviewer: Paul, Pete
Tests run: checkintests, all mustella tests.
Is noteworthy for integration: No.
Ticket Links:
http://bugs.adobe.com/jira/browse/SDK-22454
Modified Paths:
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/css/StyleDef.vm
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/css/StylesContainer.java
flex/sdk/trunk/modules/compiler/src/java/flex2/tools/PreLink.javaRevision: 11575
Author: [email protected]
Date: 2009-11-09 11:34:57 -0800 (Mon, 09 Nov 2009)
Log Message:
Put default style declarations into one class per application or module.
Generate all the default styles in one class instead of a class for each style. The name of the style class will be based on the application or module name. An application named ?\226?\128?\156foo?\226?\128?\157 will have a style class named ?\226?\128?\156_foo_Style?\226?\128?\157. The idea is to allow applications to be compiled with different themes and get their owns styles. Currently this is not possible because a global style in both themes will have the same class name, _globalStyle. Whatever class the top-level application loads the sub-applications and modules will have to use the same class because of the flash player first-class-in-wins rule. Now each application and module will have their own style class.
QE notes: None.
Doc notes: None.
Bugs: SDK-22454
Reviewer: Paul, Pete
Tests run: checkintests, all mustella tests.
Is noteworthy for integration: No.
Ticket Links:
http://bugs.adobe.com/jira/browse/SDK-22454
Modified Paths:
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/css/StyleDef.vm
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/css/StylesContainer.java
flex/sdk/trunk/modules/compiler/src/java/flex2/tools/PreLink.java
Maybe you are looking for
-
Having problem with adobe reader
Hi, I have a problem with adobe reader in my cell phone E71 model recently.I could open any pdf files till yesterday,but now without any reason the adobe reader icon in the office folder does not open.I wanna know what should I do.
-
Does airport express have to be connected to wireless modem by cable
I'm trying to set up my wireless network with my wireless modem in my hall and AirPort Extreme in lounge. I thought that the airport would use the wireless signal from the modem and operate as if it was connected by Ethernet cable. Wrong?
-
TS4123 So what if the only Winsock Provider listed is the Bonjour Namespace Provider?
AppleMobileDeviceService.exe is constantly hogging one CPU on my machine. I've tried the Winsock command line reset (netsh winsock reset) and that seemed to work for awhile. Then the problem reappears. I've tried stopping/starting or restarting the p
-
Illustrator app error at start up
I have been trying to start illustrator cs6 64 bit, I keep getting same error notice, Application loading error AppBarControls.aip, ScriptingSupport.aip, services,aip. I close error window, illustrator seems working but when I try to create new docum
-
Phantom torage iOS 8 (Photos)
Hi, I've deleted all my videos and photos from my iPhone and restarted the device several times. Yet under usage - Storage - Photos & Camera my photo library is apparently taking up 2.7GB!? I'm aware of the recent camera roll changes (Photos are now