/src/mpv5/usermanagement/Lock.java
Java | 50 lines | 17 code | 5 blank | 28 comment | 0 complexity | a897a8698f1ab30422f3946004935fe7 MD5 | raw file
1/* 2 * This file is part of YaBS. 3 * 4 * YaBS is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * YaBS is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with YaBS. If not, see <http://www.gnu.org/licenses/>. 16 */ 17package mpv5.usermanagement; 18 19import java.awt.Component; 20import mpv5.logging.Log; 21import mpv5.ui.dialogs.LoginScreen; 22 23/** 24 * 25 * 26 */ 27public class Lock { 28 29 /** 30 * Locks the given component and brings up a login window which could unlock it again 31 * @param comp 32 */ 33 public static void lock(Component comp) { 34 comp.setEnabled(false); 35 LoginScreen loginScreen = new mpv5.ui.dialogs.LoginScreen(comp); 36 } 37 38 39 /** 40 * Unlocks the given component 41 * @param frame 42 */ 43 public static void unlock(Component frame) { 44 try { 45 frame.setEnabled(true); 46 } catch (Exception e) { 47 Log.Debug(Lock.class, "Frame is not visible, can not be unlocked."); 48 } 49 } 50}