Last change
on this file since 18297 was 18297, checked in by kjdon, 15 years ago |
interface updated to display right to left for rtl languages. This code is thanks to Amin Hejazi. It seems to be only partially complete. Amin was working with Greenstone 3 so might have missed some panels
|
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
763 bytes
|
Line | |
---|
1 | package org.greenstone.gatherer.gui;
|
---|
2 |
|
---|
3 | import java.awt.*;
|
---|
4 | import java.net.*;
|
---|
5 | import javax.swing.*;
|
---|
6 | import org.greenstone.gatherer.Dictionary;
|
---|
7 |
|
---|
8 |
|
---|
9 | public class URLField
|
---|
10 | extends JTextField
|
---|
11 | {
|
---|
12 | public URLField(Color foreground, Color background)
|
---|
13 | {
|
---|
14 | super();
|
---|
15 | this.setComponentOrientation(Dictionary.getOrientation());
|
---|
16 | setBackground(background);
|
---|
17 | setForeground(foreground);
|
---|
18 | }
|
---|
19 |
|
---|
20 |
|
---|
21 | public boolean validateURL()
|
---|
22 | {
|
---|
23 | String url_string = getText();
|
---|
24 | if (!url_string.equals("")) {
|
---|
25 | // Check the URL string is valid by trying to create a URL object from it
|
---|
26 | try {
|
---|
27 | new URL(url_string);
|
---|
28 | }
|
---|
29 | catch (MalformedURLException exception) {
|
---|
30 | // URL string is invalid
|
---|
31 | return false;
|
---|
32 | }
|
---|
33 | }
|
---|
34 |
|
---|
35 | // URL string is valid
|
---|
36 | return true;
|
---|
37 | }
|
---|
38 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.