【问题标题】:display tags in jtable在jtable中显示标签
【发布时间】:2015-03-25 15:10:19
【问题描述】:

我在我的项目中使用了 Jtable 和 java spring MVC,它非常好。但是显示数据时出现问题。在我的数据中,有一个字段 Title 包含:“ 49ers Team >”。但在 jtable 中,我收到:“49ers”。 和团队>都走了。 jtable中如何显示“”和“团队>”?

【问题讨论】:

  • 标签jquery-jtable 是否正确?显示一些代码。

标签: java jquery-jtable


【解决方案1】:

这不是 JTable 问题。它对我来说很好用:

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;

public class SSCCE extends JPanel
{
    public SSCCE()
    {
        JTable table = new JTable(5, 5);
        table.setValueAt("<Team > 49ers < / Team >", 0, 0);
        JScrollPane scrollPane = new JScrollPane( table );
        add( scrollPane );
    }

    private static void createAndShowGUI()
    {
        JFrame frame = new JFrame("SSCCE");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.add( new SSCCE() );
        frame.setLocationByPlatform( true );
        frame.pack();
        frame.setVisible( true );
    }

    public static void main(String[] args)
    {
        EventQueue.invokeLater(new Runnable()
        {
            public void run()
            {
                createAndShowGUI();
            }
        });
    }
}

添加一个 System.out.println(...) 以查看从数据库返回的数据。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-03
    • 2012-10-29
    • 2012-02-06
    • 1970-01-01
    • 2011-01-20
    • 2017-05-07
    相关资源
    最近更新 更多