-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AbstractTableModel如何设置内容居中 #3
Comments
你好,可以对具体的JTable表格对象设置单元格渲染器TableCellRenderer,单元格渲染器的方法可以设置其单元格内容居中:setHorizontalAlignment(SwingConstants.CENTER)或者setHorizontalAlignment(JLabel.CENTER),效果是一样的,参数均为常量0。具体代码为:
DefaultTableCellRenderer tableCellRenderer = new DefaultTableCellRenderer();
tableCellRenderer.setHorizontalAlignment(JLabel.CENTER);
jTable.setDefaultRenderer(Object.class,tableCellRenderer);
…------------------ 原始邮件 ------------------
发件人: "LJG-V"<notifications@github.com>;
发送时间: 2020年2月7日(星期五) 中午12:09
收件人: "commonyzb/StudentManagement"<StudentManagement@noreply.github.com>;
抄送: "Subscribed"<subscribed@noreply.github.com>;
主题: [commonyzb/StudentManagement] AbstractTableModel如何设置内容居中 (#3)
你是用了AbstractTableModel接口,那你这个代码怎么修改才能使表格内容居中呢??谢谢
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
好的,谢谢,刚改好
…------------------ 原始邮件 ------------------
发件人: "commonyzb"<notifications@github.com>;
发送时间: 2020年2月7日(星期五) 中午1:14
收件人: "commonyzb/StudentManagement"<StudentManagement@noreply.github.com>;
抄送: "1308715622"<1308715622@qq.com>;"Author"<author@noreply.github.com>;
主题: Re: [commonyzb/StudentManagement] AbstractTableModel如何设置内容居中 (#3)
你好,可以对具体的JTable表格对象设置单元格渲染器TableCellRenderer,单元格渲染器的方法可以设置其单元格内容居中:setHorizontalAlignment(SwingConstants.CENTER)或者setHorizontalAlignment(JLabel.CENTER),效果是一样的,参数均为常量0。具体代码为:
DefaultTableCellRenderer tableCellRenderer = new DefaultTableCellRenderer();
tableCellRenderer.setHorizontalAlignment(JLabel.CENTER);
jTable.setDefaultRenderer(Object.class,tableCellRenderer);
------------------&nbsp;原始邮件&nbsp;------------------
发件人:&nbsp;"LJG-V"<notifications@github.com&gt;;
发送时间:&nbsp;2020年2月7日(星期五) 中午12:09
收件人:&nbsp;"commonyzb/StudentManagement"<StudentManagement@noreply.github.com&gt;;
抄送:&nbsp;"Subscribed"<subscribed@noreply.github.com&gt;;
主题:&nbsp;[commonyzb/StudentManagement] AbstractTableModel如何设置内容居中 (#3)
你是用了AbstractTableModel接口,那你这个代码怎么修改才能使表格内容居中呢??谢谢
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
好的,谢谢大佬 |
想请问一下您是怎么登录进去的 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
你是用了AbstractTableModel接口,那你这个代码怎么修改才能使表格内容居中呢??谢谢
The text was updated successfully, but these errors were encountered: