用 jformdesigner 画出来的 RsyntaxTextArea 无法正确显示行数 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
claysec
V2EX    Java

用 jformdesigner 画出来的 RsyntaxTextArea 无法正确显示行数

  •  
  •   claysec
    boku7 2022 年 9 月 9 日 1547 次点击
    这是一个创建于 1324 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我用 jformdesigner 设计了一个界面,并且开启了显示行数,当前 ui 也有行数显示,如下 bhW7b 但是在我运行起来之后就没有行数显示了 H9o4Q 刚开始以为是 Flat 皮肤和 Mig 布局问题 但是我使用官方 demo 进行测试时候发现是可以显示行数的。 ykucy

    所以我不知道怎么解决这个问题了。找遍全网也没有类似的问题,

    测试代码:

     import java.awt.*; import java.awt.event.*; import javax.swing.*; import net.miginfocom.swing.*; import org.fife.ui.rsyntaxtextarea.*; import org.fife.ui.rtextarea.*; /** * @author unknown */ public class Database extends JFrame { public Database() { initComponents(); } private void createUIComponents() { // TODO: add custom component creation code here } private void commonSql(ActionEvent e) { if(leftSplitPane.getDividerLocation() == 0){ leftSplitPane.setDividerLocation(180); }else { leftSplitPane.setDividerLocation(0); } } private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents leftSplitPane = new JSplitPane(); scrollPane1 = new JScrollPane(); commOnSQLStatementslLst= new JList(); splitPane2 = new JSplitPane(); panel1 = new JPanel(); rTextScrollPane1 = new RTextScrollPane(); sqlTextArea = new RSyntaxTextArea(); label1 = new JLabel(); encodeComboBox = new JComboBox<>(); runSqlButton = new JButton(); commOnSqlButton= new JButton(); scrollPane2 = new JScrollPane(); sqlResutlTable = new JTable(); //======== this ======== Container cOntentPane= getContentPane(); contentPane.setLayout(new CardLayout()); //======== leftSplitPane ======== { leftSplitPane.setDividerLocation(0); //======== scrollPane1 ======== { scrollPane1.setViewportView(commonSQLStatementslLst); } leftSplitPane.setLeftComponent(scrollPane1); //======== splitPane2 ======== { splitPane2.setOrientation(JSplitPane.VERTICAL_SPLIT); splitPane2.setDividerLocation(160); //======== panel1 ======== { panel1.setLayout(new MigLayout( "insets 0,hidemode 3", // columns "[fill]" + "[fill]" + "fill]" + "[fill]" + "[grow,fill]", // rows "[grow,fill]" + "[]")); //======== rTextScrollPane1 ======== { rTextScrollPane1.setLineNumbersEnabled(true); //---- sqlTextArea ---- sqlTextArea.setParserDelay(0); sqlTextArea.setSyntaxEditingStyle("text/sql"); rTextScrollPane1.setViewportView(sqlTextArea); } panel1.add(rTextScrollPane1, "cell 0 0 5 1"); //---- label1 ---- label1.setText("\u7f16\u7801:"); panel1.add(label1, "cell 0 1"); //---- encodeComboBox ---- encodeComboBox.setModel(new DefaultComboBoxModel<>(new String[] { "UTF-8", "GBK", "" })); panel1.add(encodeComboBox, "cell 1 1"); //---- runSqlButton ---- runSqlButton.setText("\u8fd0\u884c"); panel1.add(runSqlButton, "cell 2 1"); //---- commonSqlButton ---- commonSqlButton.setText("\u5e38\u7528SQL\u8bed\u53e5"); commonSqlButton.addActionListener(e -> commonSql(e)); panel1.add(commonSqlButton, "cell 3 1"); } splitPane2.setTopComponent(panel1); //======== scrollPane2 ======== { scrollPane2.setViewportView(sqlResutlTable); } splitPane2.setBottomComponent(scrollPane2); } leftSplitPane.setRightComponent(splitPane2); } contentPane.add(leftSplitPane, "card1"); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents } // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables private JSplitPane leftSplitPane; private JScrollPane scrollPane1; private JList commonSQLStatementslLst; private JSplitPane splitPane2; private JPanel panel1; private RTextScrollPane rTextScrollPane1; private RSyntaxTextArea sqlTextArea; private JLabel label1; private JComboBox<String> encodeComboBox; private JButton runSqlButton; private JButton commonSqlButton; private JScrollPane scrollPane2; private JTable sqlResutlTable; // JFormDesigner - End of variables declaration //GEN-END:variables public static void main(String[] args) { new Database().setVisible(true); } } 

    希望各位大佬能够帮忙看看是怎么回事。这事困扰我好久了

    目前尚无回复
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     897 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 32ms UTC 22:35 PVG 06:35 LAX 15:35 JFK 18:35
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86