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)

static S getTextTrim(JTextComponent c) {
  ret trim(getText(c));
}

// tested for editable combo box - returns the contents of text field
static S getTextTrim(JComboBox cb) {
  ret trim(getText(cb));
}

static S getTextTrim(JComponent c) {
  if (c instanceof JLabel) ret trim(((JLabel) c).getText());
  if (c instanceof JComboBox) ret getTextTrim((JComboBox) c);
  ret getTextTrim((JTextComponent) c);
}

download  show line numbers  debug dex   

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

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: 366 / 372
Version history: 5 change(s)
Referenced in: #1006642 #1006654 #1009787 #1010557

Formerly at http://tinybrain.de/1006455 & http://1006455.tinybrain.de