Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

22
LINES

< > BotCompany Repo | #1005989 // Try sorting table by click on header (doesn't work)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (19775L/123K).

1  
!7
2  
3  
p-awt {
4  
  final JTable table = showTable(ll(
5  
    litorderedmap("Hello" := "Yo", "Bla" := "Bla", "Ja" := "Ja ja"),
6  
    litorderedmap("Hello" := "No", "Bla" := "Blubb", "Ja" := "Vielleicht")));
7  
    
8  
  table.getTableHeader().addMouseListener(new MouseAdapter {
9  
    bool desc;
10  
    
11  
    public void mousePressed(MouseEvent e) {
12  
      TableColumnModel colModel = table.getColumnModel();
13  
      int iCol = colModel.getColumnIndexAtX(e.getX());
14  
      final int iModel = colModel.getColumn(iCol).getModelIndex();
15  
      printVars(+iCol, +iModel);
16  
      awt {
17  
        sortTableRaw(table, iModel, desc);
18  
        desc = !desc;
19  
      }
20  
    }
21  
  });
22  
 }

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005989
Snippet name: Try sorting table by click on header (doesn't work)
Eternal ID of this version: #1005989/3
Text MD5: 3ad1d6f5bcbc55393f16e952580b5bcf
Transpilation MD5: c4706332f812451fd0d5ef67f772edf6
Author: stefan
Category: javax / gui
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-12-11 20:24:41
Source code size: 660 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 555 / 697
Version history: 2 change(s)
Referenced in: [show references]