Search Results

Search found 9 results on 1 pages for 'rodion'.

Page 1/1 | 1 

  • Button layed out using layout_toLeftOf in a RelativeLayout does not show up

    - by rodion
    Hello all, I am trying to layout a Button to the left of a TextView that is centered on the screen. My layout looks like this: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="foo" android:id="@+id/center" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Left button" android:layout_toLeftOf="@id/center" /> </RelativeLayout> Unfortunately, the button just does not appear. I get the following result: As you see, the button doesn't show up. It works if I use layout_toRightOf, then the button appears to the right of the TextView, just as expected. Any ideas what I am doing wrong here?

    Read the article

  • Java, Sychronize JTable and ResultSet

    - by rodion
    Hello, I have JTable, And AbstarctDataModel with fill(ResultSet rs) methods. How to correct synchronize cursor of JTable with ResultSet's cursor? Any links? Thanx a lat. P.S. Please, add AbstractTableModel tag -- Canton of Uri's citizen

    Read the article

  • Java: Get Mainform object from JInternalFrame

    - by rodion
    Can I do this without reference to the object in the constructor? In other words, any class inherited from FrmTaoChild when creating must to add the button on the toolbar of the main window public class FrmTaoMain extends JFrame { JToolBar tbTask = new JToolBar(); public FrmTaoMain(String Caption) { super(Caption); ... FrmTaoChild FrmChild = new FrmTaoChild(tbTask,"test"); } } public class FrmTaoChild extends JInternalFrame { public FrmTaoChild(JToolBar tbTask, String Caption) { super (Caption); JButton btnTask = new JButton(Caption); tbTask.add(btnTask); } }

    Read the article

  • Accept templated parameter of stl_container_type<string>::iterator

    - by Rodion Ingles
    I have a function where I have a container which holds strings (eg vector<string>, set<string>, list<string>) and, given a start iterator and an end iterator, go through the iterator range processing the strings. Currently the function is declared like this: template< typename ContainerIter> void ProcessStrings(ContainerIter begin, ContainerIter end); Now this will accept any type which conforms to the implicit interface of implementing operator*, prefix operator++ and whatever other calls are in the function body. What I really want to do is have a definition like the one below which explicitly restricts the amount of input (pseudocode warning): template< typename Container<string>::iterator> void ProcessStrings(Container<string>::iterator begin, Container<string>::iterator end); so that I can use it as such: vector<string> str_vec; list<string> str_list; set<SomeOtherClass> so_set; ProcessStrings(str_vec.begin(), str_vec.end()); // OK ProcessStrings(str_list.begin(), str_list.end()); //OK ProcessStrings(so_set.begin(), so_set.end()); // Error Essentially, what I am trying to do is restrict the function specification to make it obvious to a user of the function what it accepts and if the code fails to compile they get a message that they are using the wrong parameter types rather than something in the function body that XXX function could not be found for XXX class.

    Read the article

  • How to pass operators as parameters

    - by Rodion Ingles
    I have to load an array of doubles from a file, multiply each element by a value in a table (different values for different elements), do some work on it, invert the multiplication (that is, divide) and then save the data back to file. Currently I implement the multiplication and division process in two separate methods. Now there is some extra work behind the scenes but apart from the specific statements where the multiplication/division occurs, the rest of the code is identical. As you can imagine, with this approach you have to be very careful making any changes. The surrounding code is not trivial, so its either a case of manually editing each method or copying changes from one method to the other and remembering to change the * and / operators. After too many close calls I am fed up of this and would like to make a common function which implements the common logic and two wrapper functions which pass which operator to use as a parameter. My initial approach was to use function pointers: MultiplyData(double data) { TransformData(data, &(operator *)); } DivideData(double data) { TransformData(data, &(operator /)); } TransformData(double data, double (*func)(double op1, double op2)) { /* Do stuff here... */ } However, I can't pass the operators as pointers (is this because it is an operator on a native type?), so I tried to use function objects. Initially I thought that multiplies and divides functors in <functional> would be ideal: MultiplyData(double data) { std::multiplies<double> multFunct; TransformData(data, &multFunct); } DivideData(double data) { std::divides<double> divFunct; TransformData(data, &divFunct); } TransformData(double data, std::binary_function<double, double, double> *funct) { /* Do stuff here... */ } As you can see I was trying to use a base class pointer to pass the functor polymorphically. The problem is that std::binary_function does not declare an operator() member for the child classes to implement. Is there something I am missing, or is the solution to implement my own functor heirarchy (which really seems more trouble than it is worth)?

    Read the article

  • Java JFrame is very strange

    - by rodion
    When I am running this, JLabel is not visible, but when I resize window (with mouse) JLabel is showed. Why? import javax.swing.*; import java.awt.*; public class FrmTaoLogin extends JFrame { private JPanel pnlLeft = new JPanel(); public FrmTaoLogin() { super(); pnlLeft.setBorder(BorderFactory.createEtchedBorder()); pnlLeft.add(new JLabel("test1")); getContentPane().add(pnlLeft,BorderLayout.SOUTH); setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(200, 200); } public static void main(String[] args) { FrmTaoLogin FrmLogin = new FrmTaoLogin(); FrmLogin.setVisible(true); } }

    Read the article

1