由买买提看人间百态

topics

全部话题 - 话题: jlabel
(共0页)
e**n
发帖数: 10
1
来自主题: Java版 - Question about displaying Chinese
I wrote a small program to display Chinese, but I can not display Chinese
correct.
Here is my code:
try
{
String s1 = "讨论";
JLabel jlTemp = new JLabel("Display: " + s1);
}
catch(Exception e)
{
}
In this case, the JLabel display garbage on the screen.
try
{
String s1 = "讨论";
String s2 = new String(s1.getBytes(), "GBK");
JLabel jlTemp = new JLabel("Display: " + s2);
}
catch(Exception e)
}
In this case, the JLabel display "????" on the screen.
Can someone tell me where my proble
v****c
发帖数: 32
2
来自主题: Programming版 - 一个Java applet小程序
一个Java applet小程序中 加了以下内容后产生的class文件在浏览器中工作不正常。
why? xiexie hui fu.
//set up text label
textL = new JLabel();
textL.setText( "Welcome to the park!" );
textL.setLocation(25,0);
textL.setSize(550,210);
textL.setFont(new Font("Arial",Font.PLAIN,36));
textL.setHorizontalAlignment(JLabel.CENTER);
contentPane.add(textL);

//set up picture label
pictureL = new JLabel();
pictureL.setIcon(new ImageIcon( "fun.jpg" ));
pictureL.setBounds(54,120,500,250)
c****u
发帖数: 3277
3
来自主题: Java版 - simple swing question
I tried to draw a graph on a jpanel, then put jtextareas and
jlabels onto that jpanel, the textareas and jlabels form an area, which
always cover my grphics completely and mess it up. Any solution?
n*******g
发帖数: 168
4
final JLabel label = new JLabel("nonothing")
这里的一个类实例被声明为final代表什么呢?
多谢!
z*********e
发帖数: 10149
5
I'm following this java tutorials- Getting Started WIth Applets
here are my files:
======================================
HelloWorld.java
import javax.swing.*;
import java.lang.reflect.InvocationTargetException;
public class HelloWorld extends JApplet{
public void init(){
try {
SwingUtilities.invokeAndWait(new Runnable(){
public void run(){
JLabel label = new JLabel("Hello World!");
add(label);
}
... 阅读全帖
G****A
发帖数: 4160
6
来自主题: Programming版 - 两个看来相似的问题
问题1:
assume that WhiteOnBlackLabel inherits a paint method from JLabel and also
implements its own version of paint.
JLabel label = new WhiteOnBlackLabel("A label");
label.paint(g); //for some Graphics object g
Which of those two implementations of paint will be executed in
label.paint(g); of this example?
paint() defined in label or paint() defined in WhiteOnBlacklabel?
问题2:
All of our Fruits inherit an equals method from class Object. Suppose that
Fruit declares its own equals method:
Object>
b***i
发帖数: 3043
7
来自主题: Programming版 - FMP tutorial
比如,按下一个按钮要打开文件,能用你这个多线程读入文件吗?给个具体例子吧。
程序就叫FMPTest,extends JFrame,里面有一个JLabel,一个JButton, 要求点击
JButton打开FileDialog,选好文本文件后,用FMP线程读入,然后在JLabel里面显示
Good出现的次数。要求不能在UI线程里面读入文件。

FMP
o**2
发帖数: 168
8
来自主题: Programming版 - FMP tutorial

这里是完整的可运行的代码。需要的FMP库在: http://search.maven.org/#browse|1968728870
import com.fastmessenger.impl.GuiMessenger;
public class Main {
public static void main (String[] args) {
GuiMessenger messenger = new GuiMessenger ();
FMPTest win = new FMPTest (messenger);
FileAnalyzer analyzer = new FileAnalyzer (messenger);
messenger.registerSwingReceiver (win, "main.frame", "setStatus");
messenger.registerReceiver (analyzer, "file.analyzer", "countWord");
w... 阅读全帖
d******n
发帖数: 83
9
来自主题: Java版 - how to paint on a Jpanel?
I only know to paint an applet. And I know there is a method named
paintComponent(Graphics page) which belongs to JComponent. But I have no idea
how to paint on a Jpanel or Jlabel. Any idea? THANKS!!!
r*******w
发帖数: 121
10
来自主题: Java版 - 几个问题
1。根据图设计class hierarchy, 那个一个一个方块的图是class,旁边1..*, 0..1是什
么意思啊?还有方块里面-name, +salary又是什么意思啊?实线虚线呢?
2。String test=new String("hello") 为什么不efficient啊
3。swing的thread safe问题(该去哪里看书呢?)。下面这个code多线程访问可能出问题
。。。怎么修改呢?是说换一个class呢,还是要加synchronization,自己加个类似cond
ition variable的东东?
public class UpdateStatus implements Runnable {
private JPanel myPanel;
public UpdateStatus(JPanel panel) {
myPanel = panel;
}

public void run() {
myPanel.add(new JLabel("90%"));
}
}
4。还是String的efficiency的问题。。。有一个Vector里面都是Stri
g*****g
发帖数: 34805
11
Only means you can't assign label to another instance.
if you later on do
label = new JLabel("something"), it will yield compilation error.
You can do label.setxxx() and change its fields however.
g*****g
发帖数: 34805
12
贴图,比如说用一个带icon的JLabel来显示车,
while(..) {
setLocation(newLocation);
sleep(xx);
repaint();
}
c*****t
发帖数: 1879
13
来自主题: Java版 - 怎么做Status Bar?
Use JLabel.
p**i
发帖数: 100
14
来自主题: Java版 - jdilog extends can't add jpanel?
问一下,我想从 jdilog 扩展写个对话框出来,但是发现想 add jpanel的时候怎么也
加不上,但是 jbutton jlabel 可
以,在网上发现别人的例子是可以加的,代码也差不多?有大虾知道为什么吗?
大家做复杂点的对话框怎么做?
Z****e
发帖数: 2999
15
来自主题: Java版 - 请教document
does ur use case require a textpane? or a readonly component will do?
maybe you can try JLabel with HTML content
d*****l
发帖数: 8441
16

好像解决了,不过没有显式地用另外的线程,用的定时器和Model对话框:
final JDialog dialog = new JDialog(this, "Auto-Close Dialog");
Timer timer = new Timer(50, new ActionListener() {
public void actionPerformed(ActionEvent e) {
dialog.setVisible(false);
dialog.dispose();
}
});
timer.setRepeats(false);
timer.start();
dialog.add(new JLabel("Generating Documents ..."));
dialog.setVisible(true); // modal dialog: applicat... 阅读全帖
R***Z
发帖数: 1167
17
来自主题: Programming版 - 两个看来相似的问题
赫赫, 都看见JLabel了, 当然是Java
h*****4
发帖数: 4219
18
来自主题: Programming版 - 抛砖引玉,来谈谈functional programming
课上刚分析过,据说是在anonymous inner class里面,对这个变量的处理其实是当作
常量了,所以要锁定住。
比方说弄了个GUI,在Jlabel那里要显示一个String,当你运行了GUI之后,这个String
就不应该由外界改变了。
h*****4
发帖数: 4219
19
来自主题: Programming版 - 抛砖引玉,来谈谈functional programming
课上刚分析过,据说是在anonymous inner class里面,对这个变量的处理其实是当作
常量了,所以要锁定住。
比方说弄了个GUI,在Jlabel那里要显示一个String,当你运行了GUI之后,这个String
就不应该由外界改变了。
(共0页)