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

14
LINES

< > BotCompany Repo | #1006455 // getTextTrim - getText() from JTextComponent, trim

JavaX fragment (include)

1  
static S getTextTrim(JTextComponent c) {
2  
  ret trim(getText(c));
3  
}
4  
5  
// tested for editable combo box - returns the contents of text field
6  
static S getTextTrim(JComboBox cb) {
7  
  ret trim(getText(cb));
8  
}
9  
10  
static S getTextTrim(JComponent c) {
11  
  if (c instanceof JLabel) ret trim(((JLabel) c).getText());
12  
  if (c instanceof JComboBox) ret getTextTrim((JComboBox) c);
13  
  ret getTextTrim((JTextComponent) c);
14  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1006455
Snippet name: getTextTrim - getText() from JTextComponent, trim
Eternal ID of this version: #1006455/6
Text MD5: 3a1de0debcdd9917f749892022361785
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-15 16:49:59
Source code size: 416 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 551 / 595
Version history: 5 change(s)
Referenced in: [show references]