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).

!7

p-awt {
  final JTable table = showTable(ll(
    litorderedmap("Hello" := "Yo", "Bla" := "Bla", "Ja" := "Ja ja"),
    litorderedmap("Hello" := "No", "Bla" := "Blubb", "Ja" := "Vielleicht")));
    
  table.getTableHeader().addMouseListener(new MouseAdapter {
    bool desc;
    
    public void mousePressed(MouseEvent e) {
      TableColumnModel colModel = table.getColumnModel();
      int iCol = colModel.getColumnIndexAtX(e.getX());
      final int iModel = colModel.getColumn(iCol).getModelIndex();
      printVars(+iCol, +iModel);
      awt {
        sortTableRaw(table, iModel, desc);
        desc = !desc;
      }
    }
  });
 }

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: 556 / 697
Version history: 2 change(s)
Referenced in: