Share on Google+Share on Google+

Web programming guidence
4 Answer(s)      8 years ago
Posted in : Applet


View Answers

January 5, 2009 at 12:44 AM

Hi friend,

import java.awt.*;
import javax.swing.*;
import java.awt.Rectangle;

import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.metal.MetalButtonUI;

public class LayoutDemo extends JButton {
private static final String uiString = "LinkButtonUI";

public static final int ALWAYS_UNDERLINE = 0;
public static final int HOVER_UNDERLINE = 1;
public static final int NEVER_UNDERLINE = 2;
public static final int SYSTEM_DEFAULT = 3;

private int linkBehavior;

private Color linkColor;

private Color colorPressed;

private Color visitedLinkColor;

private Color disabledLinkColor;

private URL buttonURL;

private Action defaultAction;

private boolean isLinkVisited;

public static void main(String[] a) {
JFrame frame = new JFrame();
frame.getContentPane().setLayout(new GridLayout(0,2));
frame.getContentPane().add(new LayoutDemo(""));
frame.getContentPane().add(new LayoutDemo(""));
frame.setSize(600, 200);

public LayoutDemo() {
this(null, null, null);

public LayoutDemo(Action action) {

public LayoutDemo(Icon icon) {
this(null, icon, null);

public LayoutDemo(String s) {
this(s, null, null);

public LayoutDemo(URL url) {
this(null, null, url);

public LayoutDemo(String s, URL url) {
this(s, null, url);

public LayoutDemo(Icon icon, URL url) {
this(null, icon, url);

public LayoutDemo(String text, Icon icon, URL url) {
super(text, icon);
linkBehavior = SYSTEM_DEFAULT;
linkColor =;
colorPressed =;
visitedLinkColor = new Color(128, 0, 128);
if (text == null && url != null)

public void updateUI() {

January 5, 2009 at 12:46 AM

private void setDefault() {
UIManager.getDefaults().put("LinkButtonUI", "BasicLinkButtonUI");

public String getUIClassID() {
return "LinkButtonUI";

protected void setupToolTipText() {
String tip = null;
if (buttonURL != null)
tip = buttonURL.toExternalForm();

public void setLinkBehavior(int bnew) {
int old = linkBehavior;
linkBehavior = bnew;
firePropertyChange("linkBehavior", old, bnew);

private void checkLinkBehaviour(int beha) {
throw new IllegalArgumentException("Not a legal LinkBehavior");

public int getLinkBehavior() {
return linkBehavior;

public void setLinkColor(Color color) {
Color colorOld = linkColor;
linkColor = color;
firePropertyChange("linkColor", colorOld, color);

public Color getLinkColor() {
return linkColor;

public void setActiveLinkColor(Color colorNew) {
Color colorOld = colorPressed;
colorPressed = colorNew;
firePropertyChange("activeLinkColor", colorOld, colorNew);

public Color getActiveLinkColor() {
return colorPressed;

public void setDisabledLinkColor(Color color) {
Color colorOld = disabledLinkColor;
disabledLinkColor = color;
firePropertyChange("disabledLinkColor", colorOld, color);
if (!isEnabled())

public Color getDisabledLinkColor() {
return disabledLinkColor;

public void setVisitedLinkColor(Color colorNew) {
Color colorOld = visitedLinkColor;
visitedLinkColor = colorNew;
firePropertyChange("visitedLinkColor", colorOld, colorNew);

public Color getVisitedLinkColor() {
return visitedLinkColor;

public URL getLinkURL() {
return buttonURL;

public void setLinkURL(URL url) {
URL urlOld = buttonURL;
buttonURL = url;
firePropertyChange("linkURL", urlOld, url);

public void setLinkVisited(boolean flagNew) {
boolean flagOld = isLinkVisited;
isLinkVisited = flagNew;
firePropertyChange("linkVisited", flagOld, flagNew);

public boolean isLinkVisited() {
return isLinkVisited;

public void setDefaultAction(Action actionNew) {
Action actionOld = defaultAction;
defaultAction = actionNew;
firePropertyChange("defaultAction", actionOld, actionNew);

public Action getDefaultAction() {
return defaultAction;

January 5, 2009 at 12:47 AM

protected String paramString() {
String str;
if (linkBehavior == ALWAYS_UNDERLINE)
else if (linkBehavior == HOVER_UNDERLINE)
else if (linkBehavior == NEVER_UNDERLINE)
String colorStr = linkColor == null ? "" : linkColor.toString();
String colorPressStr = colorPressed == null ? "" : colorPressed
String disabledLinkColorStr = disabledLinkColor == null ? ""
: disabledLinkColor.toString();
String visitedLinkColorStr = visitedLinkColor == null ? ""
: visitedLinkColor.toString();
String buttonURLStr = buttonURL == null ? "" : buttonURL.toString();
String isLinkVisitedStr = isLinkVisited ? "true" : "false";
return super.paramString() + ",linkBehavior=" + str + ",linkURL="
+ buttonURLStr + ",linkColor=" + colorStr + ",activeLinkColor="
+ colorPressStr + ",disabledLinkColor=" + disabledLinkColorStr
+ ",visitedLinkColor=" + visitedLinkColorStr
+ ",linkvisitedString=" + isLinkVisitedStr;

class BasicLinkButtonUI extends MetalButtonUI {
private static final BasicLinkButtonUI ui = new BasicLinkButtonUI();

public BasicLinkButtonUI() {

public static ComponentUI createUI(JComponent jcomponent) {
return ui;

protected void paintText(Graphics g, JComponent com, Rectangle rect,
String s) {
LayoutDemo bn = (LayoutDemo) com;
ButtonModel bnModel = bn.getModel();
Color color = bn.getForeground();
Object obj = null;
if (bnModel.isEnabled()) {
if (bnModel.isPressed())
else if (bn.isLinkVisited())

} else {
if (bn.getDisabledLinkColor() != null)
super.paintText(g, com, rect, s);
int behaviour = bn.getLinkBehavior();
boolean drawLine = false;
if (behaviour == LayoutDemo.HOVER_UNDERLINE) {
if (bnModel.isRollover())
drawLine = true;
} else if (behaviour == LayoutDemo.ALWAYS_UNDERLINE || behaviour == LayoutDemo.SYSTEM_DEFAULT)
drawLine = true;
if (!drawLine)
FontMetrics fm = g.getFontMetrics();
int x = rect.x + getTextShiftOffset();
int y = (rect.y + fm.getAscent() + fm.getDescent() + getTextShiftOffset()) - 1;
if (bnModel.isEnabled()) {
g.drawLine(x, y, (x + rect.width) - 1, y);
} else {
g.drawLine(x, y, (x + rect.width) - 1, y);
Visit for more information:


January 11, 2009 at 2:19 AM

Dear Sir/Madam
Received the programee.
Thank you very much for the programme.
When I run the programme, two out put displayed.
thanks once again for the programme.

Now my main wish, is to design a web site and host with the help of Can I please be helped with the free study meterial as and how to design and the proceedure for hosting.

I am very much thankfull to you for the favor received.


Related Tutorials/Questions & Answers:
Web programming guidence - Applet
Web programming guidence  Dear Sir/Madam, I have studied (little) Java but not having good knowledge. I wish to host a simple web site... in each button. And also please give me the guidence for developing web
web programming
web programming  what is best choice java or .net for web applications
web programming
web programming  what is best choice java or .net for web applications
Web programming
Web programming  Write a program in servlet by using JDBC to display the records of employees from a table called employee
web programming - JSP-Servlet
web programming   Write a JSP page to display the number of hits to this page. (Hint: use application scope of java bean).  Hi Friend, Please visit the following link:
web programming - JSP-Servlet
web programming  9)Create an HTML page containing the following features a.Create a login JSP page with username , password and submit button. b.On submit, display message ?Thank you for logging in ? Also create cookies
web programming - JSP-Servlet
web programming  Write a JSP program to display current date and time and suitable welcome message. 1.If time is between 5AM and 12 PM display welcome message as ?Good Morning? 2.If time is between 12 PM and 5 PM display
web programming - JSP-Servlet
web programming  6) Create an HTML page containing the following features a.A combo box containing the list of 7 colors: Violet, Indigo, Blue, Green, Yellow, Orange, Red b.An empty 1X1 table with default background color
web programming - Java Beginners
web programming  4) Create two HTML pages a. First page with the following features i. An image(logo) with a company name as the heading in the top center ii. This page containing an HTML form, two text boxes to get First Name
could you suggest me that in which area i have to do a project?i want a complete guidence to complete my project.
could you suggest me that in which area i have to do a project?i want a complete guidence to complete my project.  could you suggest me that in which area i have to do a project?i want a complete guidence to complete my project
Black Berry Programming - MobileApplications
with the GPRS will any one give guidence for me i am learner now i know some programming knowledge in j2me please provide some help thanks in advance
web  what do you mean by stacking elements? explain with example(in web programming
web  what do you mean by stacking elements? explain with example(in web programming
Programming  Given a number n, write a programming to determine its square root if it is possible, in the contraly case print an appropriate massege on the screen
Java Constructor programming for single and double constructor  write a program which have no argument constructor ,single parameter constructor constructor,double parameter constor,and the now when we create a object
New to Java programming
is a programming language which you can use to develop the Desktop, web , Mobile... Programming Multithread Programming Java Applets Java Web Applications... Programming in Java Web Application Development After learning
Unix Web Hosting
Unix Web Hosting Unix Web Hosting is the type hosting provided on the Unix Servers. Unix Web Hosting is very reliable hosting option. Unix Hosting provides Perl programming, PHP programming and MySQL & PostgreSQL databases
Ajax programming
concept. What should be my starting point for Ajax programming? Thanks   Hi, If you have prior programming experience in any web development...Ajax programming  Hi, How I can start ajax programming easily? I
programming questions
programming questions  this is my assignment questions please help me... the programs in c# language Describe the following with respect to creating Web Forms in .Net environment: a. Web Form Life Cycle b. Creating a Web Form
Java Programming Language
Java Programming Language  Hi, For beginner which programming concepts is important? Discuss the importance of Java programming language. In the discussion please let's know how to use Java in developing web applications
network programming
network programming   Tutorial for Network programming and administration
Programming with JSP
Programming with JSP  Who will post me the answer
Java Programming
Java Programming  Hi, What is Java Programming? How I can learn Java Programming in one month? Thanks
ajax programming
Ajax Programming What is Ajax Programming? Asynchronous JavaScript and XML... the section of the web page without reloading the whole page. This is the technique to creating faster web pages which is also more integrative. This technique
Programming with JSP
Programming with JSP  Write a program using jsp that accepts a course code as input and displays the course title the program to which it belongs
Programming (general)
Programming (general)  I haven't yet started college/university but I'm interested in studying programming. I wondering if programming is difficult or confusing with all the codes you have to learn? Also how many languages would
programming concept
programming concept  Write a program that allows the user to input a total dollar amount for an online shopping order and computes and outputs the shipping cost based on the following schedule
programming of foxpro
programming of foxpro  hello sir , sir i am use the foxpro . but i know about c . sir how can i learn fox pro . i know about something about foxpro
socket programming
socket programming  how to create server socket in web will read parameter from file
C Programming
C Programming  hi,how can i write a program in C programming to place reservation in air plane from the menu let the user to inter his/her gender(W or M)and draw seats by using ascii codes and choose where he/she will sit
Java Spring Hibernate Struts Training Error in calling javascript function from java prg Creating an Applet java program Display Java in JSP Draw bufferimage in jpanel using netbeans Moving Applet Problem c programming Attendence Management system java program of different shapes help applet printing p applet dought Help please, some strange errors Write an applet to display scrolling image in an applet window using thread. Simple Java applet that need usernam, password and textfield. conversion Applet java program java program java program scrolling text in applet java java applet java applet project in java using applet and servlet...which tool i should use?eclipse or netbeans? java user input to database user input to database user input to database button to accept user input jframe what is web .config method Can any one please help me in this ,,,,,,, need java code for this ,,,,please anyone applet question Write an Applet which display current date and time on the web page?? Write an Applet which display current date and time on the web page?? Java Applet - Adding a Button to Decrease a Total Applet Application how to drag top most images which is draw on applet. convert java Application to Java Applet convert java Application to Java Applet Problem In applet Its run on browser but hang and blinking when image is draging some where. how to access database in applet How to add dropdown list in a row of a sort table applet? java project topics plz anyone can solve my Layout Manager Project Guidance applet is running but no display


Advertisement null